Is it possible to read the mass of a rigid body?

Post Reply
s_kohan
Posts: 5
Joined: Tue Apr 02, 2019 9:11 am

Is it possible to read the mass of a rigid body?

Post by s_kohan » Sun Nov 17, 2019 4:10 pm

This seems like it should be simple, but I don't see any way to do it in the API.

User avatar
drleviathan
Posts: 558
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Is it possible to read the mass of a rigid body?

Post by drleviathan » Mon Nov 18, 2019 4:51 am

The btRigidBody class does not store mass. Instead it has a data member called m_inverseMass. This because it never actually multiplies by mass - it always divides instead.

You can use btRigidBody::getInvMass() to get the inverse mass, and then you can invert that to get mass.

Post Reply