# physics novice question: how to compute inertia tensor?

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

## Recommended Posts

I very understand the physical description of inertia tensor, but I don't know how to compute this matrix if I use a AABB, Sphere, Cylinder or ConvexHull as the object bound volume. Who can give me some help? Tutorials, demo, source code... THX:)

##### Share on other sites
Some general solutions work on polyhedrons (sphere, box, etc., have simple formulas).

http://www.cs.berkeley.edu/~jfc/mirtich/massProps.html (includes C source).
http://citeseer.ist.psu.edu/mirtich96fast.html (original paper).
http://www.geometrictools.com/Physics.html (Wm3PolyhedralMassProperties.cpp).
http://number-none.com/blow/inertia/bb_inertia.doc

For game applications, given that most objects are tweaked for behavior, you can:

1. Take the vertices for the mesh object and assign a mass defined by the object's total mass/numVertices, converting them to particles that make up the total mass of the object.
2. Compute the inertia tensor for the newly created particles.
3. This will give an approximation with all the mass defined in particles for the object's "shell".
4. Tweak the inertia tensor creation by scaling the size of the mesh to move the mass distribution inward (e.g scale by 2/3).

Once the inertia tensor is created, you'll have a 3x3 scale matrix. To simplify run-time calculations and promote easy tweaking, you can remove any rotation from the 3x3 scale matrix using Ken Shoemake's decomp_affine() routine or similiar method. Transpose/invert the extracted rotation and apply to the inertia tensor and original object's vertices. Now you can use the diagonal of the inertia tensor and store/trivially-further-tweak as a simple 3-vector (or modify just the diagonal of a scale matrix). The inverse inertia tensor (used at runtime to scale angular momentum) is also easy and fast to compute using the simplified diagonal (3-vector) form (1/ix, 1/iy, 1/iz).

[Edited by - John Schultz on April 26, 2005 1:26:43 PM]

##### Share on other sites
Oh, thanks for you detailed replys and all those resource links :)

• ### What is your GameDev Story?

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

• 11
• 15
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
634151
• Total Posts
3015817
×