I'm having a bug due to collision normal adjustment made between a static mesh & a dynamic rigid body. Indeed I'm calling btAdjustInternalEdgeContacts in a processContactPoints, but as contacts points world position is recomputed from adjusted normal, this breaks the process contact coherency in Bullet that recomputes world positions from local ones each frame and then remove contacts when they are not close enough. When this piece of code is executed in btAdjustInternalEdgeContacts :
Code: Select all
btVector3 newNormal = colObj0->getWorldTransform().getBasis() * clampedLocalNormal;
// cp.m_distance1 = cp.m_distance1 * newNormal.dot(cp.m_normalWorldOnB);
cp.m_normalWorldOnB = newNormal;
// Reproject collision point along normal. (what about cp.m_distance1?)
cp.m_positionWorldOnB = cp.m_positionWorldOnA - cp.m_normalWorldOnB * cp.m_distance1;
cp.m_localPointB = colObj0->getWorldTransform().invXform(cp.m_positionWorldOnB);
In my opinion the reel problem is that processContact callback is called even if no contact point has been updated during narrowphase collision detection, Bullet waits for recomputed contact world positions being separated enough in order to remove a contact (I suppose this ensure kind of contact points temporal coherency). Do you see what I mean ? Can you reproduce this bug ? Do you need more informations ?
So what is the best solution ? Should we recompute world positions when contact normal as changed (in all case this adjustment is an approximation...) ? Should we clear manifold when no contact point is updated by narrow phase collision algorithm (my preferred solution...) ? Ant other idea ?
Thank you.
Romain