Multiple shape inertia center

bonjovi
Posts: 35
Joined: Mon Jul 20, 2009 12:58 pm

Multiple shape inertia center

Post by bonjovi »

Hi, I've a question about multiple collision shapes object (rigid object):

I use to work with ODE and there are several functions like dMassAdd, dMassTranslate etc. I use it for computing the mass center of several shapes (that are a rigid assembly) that have different type (box, sphere ...), masses and sizes. The goal is to find the mass center of the body and its inertia matrix.

My question : is there something similar with Bullet ?

Because:
btVector3 localInertia(0,0,0);
_colShape->calculateLocalInertia(GetMass(),localInertia);
btRigidBody::btRigidBodyConstructionInfo rbInfo(GetMass(),_internalmyMotionState,_colShape,localInertia);

It seems that there is no inertia matrix here (code from samples). There is only 1 vector, and no tool for combine several shapes ...

Thank you (sorry if a post olready exists, i did not find it !!)
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Multiple shape inertia center

Post by Erwin Coumans »

You can use btCompoundShape::calculatePrincipalAxisTransform(btScalar* masses, btTransform& principal, btVector3& inertia) const;

Let's try to add an example how to use this for Bullet 2.75
Hope this helps,
Erwin