# computing the inertia tensor for...

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

## Recommended Posts

I need to know how to compute the inertia tensor (3D) for an ellipsoid, tetrahedron, pyramid, and cone. source code would be appreciated.

##### Share on other sites
looking at the formula for a spheres inertia, I assume this will work for an ellipsoid...
Matrix inertia();inertia._11 = 0.4f * mass * radius.y * radius.z;inertia._22 = 0.4f * mass * radius.x * radius.z;inertia._33 = 0.4f * mass * radius.x * radius.y;

...is this correct?

##### Share on other sites
This(scroll down), this, this. I think that's all the shapes you need, if not google for "moment inertia <shape>". Place the values of those formulas on the diagonal of the inertia tensor.

If you need other shapes, you can calculate the moment of inertia yourself, there's a good description how to do it for arbitrary shapes in "Game Physics" by Eberly.

##### Share on other sites
thanks ...now I only need the formula for the moment of inertia of a square pyramid.

##### Share on other sites
pyramid: Iz = 0.1 * m * a²
cone: Ix = 0.3 * m * r²
Iz = 0.15 * m * (r² + 0.25 * h²)

##### Share on other sites
moment of inertia for general rotational bodies:

Ix = 0.5 * d * PI * INTEGRAL(r^4 dx)

where d = density and
r = the funtion that defines the shape when you cut it along its rotation axis

• ### What is your GameDev Story?

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

• 14
• 14
• 45
• 22
• 27
• ### Forum Statistics

• Total Topics
634044
• Total Posts
3015211
×