Forces in a rigid body

inakin
Posts: 9
Joined: Wed Jan 16, 2008 6:36 pm

Forces in a rigid body

Post by inakin »

How can I get all the forces that acts on a rigid body?

I have seen that a I could obtain velocity or mass but I can not get the forces that acts on a rigid body.

Thank you.
acx01b
Posts: 10
Joined: Thu Jan 15, 2009 12:42 pm

Re: Forces in a rigid body

Post by acx01b »

you could add in btRigidBody.h :

class btRigidBody {
...

btVector3 getTotalForce()
{
return m_totalForce;
}


btVector3 getTotalTorque()
{
return m_totalTorque;
}

}
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Forces in a rigid body

Post by Erwin Coumans »

I assume you are referring to constraint forces, due to contact and joint constraints?

This information is not directly stored inside the btRigidBody but for each constraint and contact: see btTypedConstraint::getAppliedImpulse and btManifoldPoint::m_appliedImpulse

You can get access to the contact constraint by iterating over all btPersistentManifold objects, and non-contact constraint through btRigidBody::getNumConstraintRefs/getConstraintRef.
Hope this helps,
Erwin