Possibly a bug; using lateral friction and a mesh shape

Post Reply
mdias
Posts: 12
Joined: Thu Jun 28, 2012 2:21 pm

Possibly a bug; using lateral friction and a mesh shape

Post by mdias »

Hi

Considerations:
I have a rigid body box (let's call it Player) sitting on a static btBvhTriangleMeshShape (let's call it Platform), and I'm using lateral friction to slide the Player over the Platform. Works pretty good.
Both the Player and the Platform has a friction of "0.5".
I am not using btAdjustInternalEdgeContacts() on the mesh shape yet.
solverInfo.m_solverMode |= SOLVER_ENABLE_FRICTION_DIRECTION_CACHING | SOLVER_USE_2_FRICTION_DIRECTIONS.
Using most recent bullet from svn.

The problem:
If the player stops sliding while on a particular position on an edge of the mesh shape, it will no longer move if applying lateral friction again.
I believe something gets cached that doesn't take lateral friction into account somewhere.

Hack that seems to fix it for me:
Implement CustomManifoldResult which extends btManifoldResult and use custom near callback to use it. The implementation is basically a copy-paste from the original bullet's implementation with small modifications to integrate lateral friction setting on my engine and so on.
This CustomManifoldResult fixes the issue by removing old contact points that have "m_lateralFrictionInitialized == false".
Post Reply