Sunday, February 21, 2016

unity - In Unity3D, what is the relation between inertiaTensor and inertiaTensorRotation?


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?



Answer



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.




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...