# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### Dark Physics & Dark A.I. & Dark Dynamix / [Dynamix] making motors and machinery

Message
Posted: 14th Jun 2012 03:58
Sometime in my project i will need to make motors and machinery. For example, a joint with only one twisting degree of movement that constantly spins but not kinetically. I could do that by just adding force constantly, but how could i change the amount of torque without changing the speed?
I will also need to make a piston thing. How can i set that up so that i can change the force but not the piston's actual movement speed?

"This plan is so perfect... it's retarded."
Posted: 14th Jun 2012 14:33
I would say, simulate friction manually. Apply the same force all the time to your moving objects, be it a wheel or a piston, but then get it's speed and apply force in the opposite direction proportional to the speed. Tweak the values until it reaches an equilibrium you're happy with. Therefore, when stationary, the force will be maximum, but at a certain speed the opposing force will be equal to the pushing force and it won't accelerate.

Alternatively you could just reduce the force you apply based on the speed, but simulating friction seems to be the most intuitive method. Then you can just say my piston provide 50nm of force, so I will set that whenever it's firing. Then put your friction into another equation ... I know at 500m/s the reistance of the pistol/change in momentum create an opposing force of 50/NM, so I will apply opposite force accordingly.

Posted: 15th Jun 2012 12:40
PhysX supports joints that 'drive' to a given velocity or a given position/orientation. I am adding the required commands and will document them as best as I can but I will not have time to do much testing or create an example.

Although at some point after the update I could provide an example of how to use it, once I figure it out

I think these commands may help you too Fallout, instead of adding force to your crusher you may be able to 'drive' it to one position and then back again.

Here they are:

The drive orientation takes a quaternion there, I will probably change that to take euler angles.

Posted: 15th Jun 2012 13:11 Edited at: 15th Jun 2012 13:15
Quote: "The drive orientation takes a quaternion there, I will probably change that to take euler angles."

Hi Matty, I would suggest giving us both choices with that. People that might now how to use the DBPro 3D Math's Matrix4 functions may like having the quaternion method.

EDIT: Arg... I thought DBPro had Quat functions... ? nm...

ExoDev.Com - A Game Development Tools Website! Featuring: XBOX360 CONTROLLER LIBRARY
Posted: 15th Jun 2012 14:34 Edited at: 15th Jun 2012 14:34
There are four variations of that function now.

The 'local' and 'global' ones take euler angles, you can use the first one if you have built your own quaternion for whatever reason.