2
\$\begingroup\$

In there are two properties on rigidbody that correspond to the moment of inertia tensor.

One of them is: rigidbody.inertiaTensor, which I know is the diagonal of the inertia tensor,
The other is rigidody.inertiaTensorRotation, which I don't quite understand. I have, though, created a rigidbody in such a way that I get it to be other number than Quatenion.identity, but I still don't see the connection.

Can I describe the products of inertia tensor with the rotation or ... what is the relation between them and where would I require them?

\$\endgroup\$
  • 1
    \$\begingroup\$ Have you investigated this item answers.unity3d.com/questions/48836/… ? \$\endgroup\$ – teodron May 17 '16 at 15:50
  • \$\begingroup\$ What I suspect is that the inertiaTensor property helps you set the inertia tensor in the local object space (i.e. the canonical one). The rotation property is a quaternion that should relate the local frame to the global, world one. I do not know how they compute this quat behind the scenes (perhaps it gets computed by the collision handler). What is puzzling is why they store it there and not in the global rotation of the body to start with. \$\endgroup\$ – teodron May 17 '16 at 15:58
  • \$\begingroup\$ @teodron nice find, hadn't investigated it before! Probably wrong keywords, thanks! \$\endgroup\$ – joltmode May 17 '16 at 19:47
1
\$\begingroup\$

inertiaTensor is a Vector3, inertiaTensorRotation is a Quaternion. And from the docs for inertiaTensor:

The inertia tensor is rotated by the inertiaTensorRotation.

Essentially, inertiaTensor is the moment of inertia (defined as a tensor) and the inertiaTensorRotation is how that tensor is rotated.

If you'd like them to be calculated automatically, you don't set them. Or you can call Rigidbody.ResetInertiaTensor which:

After calling this function, the inertia tensor and tensor rotation will be updated automatically after any modification of the rigidbody.

\$\endgroup\$
  • \$\begingroup\$ So, whenever I look to use inertia tensor, I should always use it like Vector3 realTensor = rb.inertiaTensorRotation * rb.inertiaTensor;? \$\endgroup\$ – joltmode May 17 '16 at 19:48
  • \$\begingroup\$ From what I understand, this is what happens internally when using the tensor. After all, it does say "The inertia tensor is rotated by the inertiaTensorRotation.". \$\endgroup\$ – MichaelHouse May 17 '16 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.