Page 1 of 1

Center of mass computation for btGImpactMeshShape

Posted: Mon Mar 17, 2014 11:27 am
by keev
Hi all,
I'm dealing with collisions of nonconvex rigid bodies, using btGImpactMeshShape.
BtGImpactMeshShape expects the origin to be the Center of Mass.
I have some models which don't meet this requirment, but I would like to use them.
Is there a function in bullet to compute the center of mass(I haven't found one) or do you know any other tools to compute the center of mass of surface meshes?

Thanks a lot!

Re: Center of mass computation for btGImpactMeshShape

Posted: Mon Mar 17, 2014 6:26 pm
by Moose
There is btRigidBody::getCenterOfMassPosition() you can try.
I remember having done this, it should be possible.

HTH,
Moose

Re: Center of mass computation for btGImpactMeshShape

Posted: Tue Mar 18, 2014 10:53 am
by keev
Thanks for your respond.
But btRigidBody::getCenterOfMassPosition() only works if the Body is initialized with the center of mass in the origin.
Otherwise it assumes to initial origin to be the center of mass and returns the current position of this point, so this isn't a solution to my issue.
This topic was already discussed in http://www.bulletphysics.org/Bullet/php ... f=9&t=2209 , so it seems that I need to compute the center of mass by hand.