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 :
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);
positionWorldOnB is adjusted from positionWorldOnA, thus contacts points never separates even if body are separating progressively. This leads to contact point between static mesh & dynamic rigid body never removed even both involved bodies are separating slowly (for sure bodies's aabb must overlap for this bug to occur).
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 ?