Your problem caller "Internal Edge Collision". I just found the solution few our hour ago.
If you are using btHeightfieldTerrainShapefor your world then you must use btBvhTriangleMeshShape to slove this problem.
Here is the answer.
Add this callback:
static bool CustomMaterialCombinerCallback(btManifoldPoint& cp,const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
{
btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1);
return true;
}
extern ContactAddedCallback gContactAddedCallback;
Afterwards create the btBvhTriangleMeshShape
and add this code where pGround
is your btBvhTriangleMeshShape
:
// Enable custom material callback
pGround->setCollisionFlags(pGround->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
btTriangleInfoMap* triangleInfoMap = new btTriangleInfoMap();
btGenerateInternalEdgeInfo(pGroundShape, triangleInfoMap);
Or you can open the InternalEdgeDemo
example in Bullet
to see how to implement it in detail.