- Home /

# How to calculate inertia tensor and tensor rotation manually

I'm trying to set the moment of inertia of a compound object (one object with a Rigidbody and multiple child objects with simple colliders). I need to set the `Rigidbody.inertiaTensor`

and `Rigidbody.inertiaTensorRotation`

manually because the child objects have different material densities.

I have calculated the inertia tensors for each child object around its center of mass as well as the center of mass of the parent object. I believe I can calculate the moment of inertia around the parent center of mass by adding all the individual moments of inertia of the child objects and then adding the moments of inertia of the children as point masses around the parent center of mass (might be wrong on this?).

What I don't understand is how to translate this into this Vector3 inertia tensor and Quaternion tensor rotation that Unity uses; the tensor rotation in particular I don't really understand what it represents. If I had the final moment of inertia of the compound object as a Matrix4x4, could I turn it into this Vector3 + Quaternion system? Is it possible to do these calculations while staying in the Vector3 + Quaternion space?

If nothing else, I want to know how the Rigidbody.inertiaTensorRotation is calculated and what it actually represents. The documentation says that "the inertia tensor is rotated by the `inertiaTensorRotation`

", but I can't seem to find a relationship between the child transform rotation and it's effect on the `inertiaTensorRotation`

. I've tried visualizing it by making a parent object with a Rigidbody with one child 1x1x1m cube and drawing the `inertiaTensor`

vector rotated by the `inertiaTensorRotation`

, but it just seems to jump around wildly as I slowly rotate the different axes of the box. The only pattern I've noticed is that if I only rotate 1 axis and all the others are 0, then the `inertiaTensorRotation == Quaternion.identity`

Appreciate any help with this.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.