Jump to content
  • Advertisement
Sign in to follow this  
Dirk Gregorius

Capsule Moment Of Inertia

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is how it's done in Open Dynamics Engine (ODE), and it work well for me too =D

void dMassSetCappedCylinder (dMass *m, dReal density, int direction,
dReal radius, dReal length)
dReal M1,M2,Ia,Ib;
dUASSERT (direction >= 1 && direction <= 3,"bad direction number");
dMassSetZero (m);
M1 = M_PI*radius*radius*length*density; // cylinder mass
M2 = (REAL(4.0)/REAL(3.0))*M_PI*radius*radius*radius*density; // total cap mass
m->mass = M1+M2;
Ia = M1*(REAL(0.25)*radius*radius + (REAL(1.0)/REAL(12.0))*M1*length*length) +
M2*(REAL(0.4)*radius*radius + REAL(0.375)*radius*length + REAL(0.25)*length*length);
Ib = (M1*REAL(0.5) + M2*REAL(0.4))*radius*radius;
m->_I(0,0) = Ia;
m->_I(1,1) = Ia;
m->_I(2,2) = Ia;
m->_I(direction-1,direction-1) = Ib;

# ifndef dNODEBUG
checkMass (m);
# endif

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!