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.
Forces in a rigid body
-
- Posts: 10
- Joined: Thu Jan 15, 2009 12:42 pm
Re: Forces in a rigid body
you could add in btRigidBody.h :
class btRigidBody {
...
btVector3 getTotalForce()
{
return m_totalForce;
}
btVector3 getTotalTorque()
{
return m_totalTorque;
}
}
class btRigidBody {
...
btVector3 getTotalForce()
{
return m_totalForce;
}
btVector3 getTotalTorque()
{
return m_totalTorque;
}
}
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Forces in a rigid body
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
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