get force from collision impulse : m_appliedImpulse always = 0

Post Reply
hyyou
Posts: 93
Joined: Wed Mar 16, 2016 10:11 am

get force from collision impulse : m_appliedImpulse always = 0

Post by hyyou » Mon Mar 05, 2018 9:54 am

How to get force from collision impulse?
I used a recommended approach. It doesn't work. (i.e. just almost work)

Let's say there are 2 bodies.
Assume that they collide each other at t=1.

t=1: The contact is created but m_appliedImpulse = 0.

Code: Select all

btWorld->stepSimulation(...);

//..... iterating manifold ....
int numContacts = contactManifold->getNumContacts();             //=1
for (int j=0;j<numContacts;j++){
   btManifoldPoint& pt = contactManifold->getContactPoint(j);    // get contact point
   if (pt.getDistance()<0.f){// see if obA and obB collide
       float impulse = pt.m_appliedImpulse;                      //=0
   ......

t=2: The force is accumulated into the manifold point correctly, but it is removed before I read it.

Code: Select all

btWorld->stepSimulation(...);                                //the "pt.m_appliedImpulse" is modified

//..... iterating manifold ....
int numContacts = contactManifold->getNumContacts();         //=0 (I'm sad)

    //Strange!  contactManifold.m_pointCache[0].m_appliedImpulse = some meaningful value
   ......
Related topics :
- https://pybullet.org/Bullet/phpBB3/view ... =9&t=10599 (same approach)
- https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=4136 (state that it can't be used anymore)
- https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=2568 (same approach)

Post Reply