Rotational units?

lwi
Posts: 2
Joined: Wed Jul 03, 2013 9:06 pm

Rotational units?

Post by lwi »

What are the units of the parameters of RigidBody's applyTorque applyTorqueImpulse and setAngularVelocity methods?
I was looking for a clear description but can't find the information anywhere, in the source code or online.

thanks,

Lwi.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Rotational units?

Post by Basroil »

Angular velocity will be in rad/s, just like most other things dealing with angular velocity. The other two are a bit harder to state because they aren't always exactly equal to the equivalent MKS values (i.e. 1.4Nm/=1.4 torque units) due to m_angularFactor and m_linearFactor variables. Even if those two are (1,1,1), there's a dozen other reasons why torques might be out of sync with reality.

The difference between torque impulse and torque though is a bit more subtle, where torque just adds the amount to the total torque on the object, while impulse torque adds to the velocity directly. In the case of a single object in space with no collisions or gravity, they would theoretically be the same thing, but in common use they would be slightly different in result (depending on torques involved relative to the mass matrix of the object).

I can't be 100% certain, since I just quickly looked at the source code for those parts. It got me thinking so I looked it up, and it actually lead me to rethink the high framerate hinge joint motors I had been using due to issues with bullet's default settings. Thanks for the question even if my answer is useless or wrong! :D
lwi
Posts: 2
Joined: Wed Jul 03, 2013 9:06 pm

Re: Rotational units?

Post by lwi »

so basically, just to be as clear as possible, setAngularVelocity and applyTorqueImpulse parameters are both in rad/s for each principal axis, and applyTorque is in Nm for each principal axis. right?
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Rotational units?

Post by Basroil »

According to the API reference, torque and torque impulse work in torque units. Torque impulse just gets calculated instantly while torque waits for next integration.