# Need Help With Inertial tensor

This topic is 1794 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

HI! Im currently working with Navidia PhysX. I resently encxountered a problem. Im trying to calculate the torque I need to apply to rotetate a Rigidbody between two rotations, over a set time. I find the difference between a target quaternion, and the RigidBody's current rotation, then I convert this into a euler rotation, and multiply by the diagonal of the RigidBody's Inertial tensor. I then convert this into Axis Angle form, and plug it into RigidBody.addTorque(vector). The results im getting from this are incorrect.

MY PROBLEM: The inertial tensor is in body space while the target rotation, and RigidBody rotation are in global space (the addTorque(vector) function also takes a axis angle rotation that is in global space). How do I over come this? Do I need to convert my varables somehow?

##### Share on other sites

If the tensor is a vector or matrix, you could multiply with the inverse transformation matrix of the body you are talking about. This should transform it from body to world space. This works because

A * A^-1 = I

where A is a matrix.

In other words, it's like dividing by itself to get to 1(identity). This has the effect of 'undoing' any transformation and what is left is in 'world' space.

Edited by Doublefris

##### Share on other sites

Also, I don't think you need to convert to euler angles, just convert your quaternion to an axis-angle or get it directly. Then you should transform this axis vector by the inverse matrix like I described in the previous post.

##### Share on other sites

Also, if you are working with quaternions, the inverse of a unit quaternion is it's conjugate.

##### Share on other sites

HI! Im currently working with Navidia PhysX. I resently encxountered a problem. Im trying to calculate the torque I need to apply to rotetate a Rigidbody between two rotations, over a set time. I find the difference between a target quaternion, and the RigidBody's current rotation, then I convert this into a euler rotation, and multiply by the diagonal of the RigidBody's Inertial tensor. I then convert this into Axis Angle form, and plug it into RigidBody.addTorque(vector). The results im getting from this are incorrect.

MY PROBLEM: The inertial tensor is in body space while the target rotation, and RigidBody rotation are in global space (the addTorque(vector) function also takes a axis angle rotation that is in global space). How do I over come this? Do I need to convert my varables somehow?

The inertia tensor is not a transformation; it is a property that is related to the distribution of mass about a point. Typically, the inertia tensor is defined about the center-of-mass of a rigid body. If you are trying to rotate about another point then you need to use a different inertia tensor. Fortunately, there is an easy way to do that. The transform, if it needs to be done, should be to apply the torque in the body space.

-Josh

##### Share on other sites

none of these worked for me sorry.

##### Share on other sites

Seems to me that you just need to use a few matrices to convert back and forth. Your difference quaternion changes an object from it's local orientation to the target one. What space do you think it's in? what space is the inertial tensor in? and finally what space does your torque vector need to be in? Answer these questions and you should have what you need.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634112
• Total Posts
3015580
×