How to get the friction force in Bullet?

Post Reply
daye
Posts: 3
Joined: Mon Sep 04, 2017 2:59 am

How to get the friction force in Bullet?

Post by daye » Wed Jul 11, 2018 2:44 am

I'm the beginner of Bullet. In my work, I want to get the friction force between the bodies' interaction. I noticed that m_appliedImpulseLateral1 and m_appliedImpulseLateral2 in btManifoldPoint Class maybe the friction impulse during the contact procress. So I calculated the friction force as follow:
<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>
int numManifolds = dispatcher->getNumManifolds();
for (int i=0; i<numManifolds; i++)
{
btPersistentManifold* manifold = dispatcher->getManifoldByIndexInternal(i);
btScalar totalFric1=0.0f;
btScalar totalFric2=0.0f;
for(int p=0; p<manifold->getNumContacts(); p++)
{
totalFric1 +=manifold->getContactPoint(p).m_appliedImpulseLateral1;
totalFric2 +=manifold->getContactPoint(p).m_appliedImpulseLateral2;
}
std::cout<<"total fric1 force="<<totalFric1/dt<<std::endl;
std::cout<<"total fric2 force="<<totalFric2/dt<<std::endl;
}
<<<<<<<<<<<<<<>>>>>>>>>>>>>>>><br/>
However, total fric2 is always equal 0 and toal fric1 is not equal to the solution which is simply calculated by friction coefficient times normal force.
I'm confused about it for a couple of days. Any problem about my code? How to get the exact friction force in Bullet?
Thanks for your reply!

Post Reply