Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Inertia tensor in Matrix Form from InertiaTensor and InertiaTensorRotation

Discussion in 'Physics' started by Maeslezo, Jul 28, 2020.

  1. Maeslezo


    Jun 16, 2015

    Inertia tensor is normally defined as a 3x3 Matrix
    Unity and Physx give something equivalent, an IntertiaTensor, and an InertiaTensorRotation. I think they do it like this because it is cheaper (3+4 = 7 values) against (3x3=9 values).

    My question is, having an InertiaTensor and an InertiaTensorRotation, how can I calculate the 3x3 Inertia Tensor?

    I reckon this should be quite straightforward but I can't get the maths right

    I am tempted to do:
    Code (CSharp):
    1. var intertiaMatrix = Matrix4x4.TRS(Vector3.One, inertiaTensorRotation, inertiaTensor)
    Because TRS transforms the quaternion in a canonical form and it is scaled by the inertia tensor

    Thank you
    Last edited: Jul 28, 2020