Right now it still uses a contact added callback, but once the utility has been tested properly we can integrated it more tightly. There is a preprocessor code included.
See a modified ConcaveDemo as example code attached to also http://code.google.com/p/bullet/issues/detail?id=27#c15
In this demo you can press 'n' to disable the utility, to see the cube hitting the internal edges.
Initialization:
Code: Select all
btBvhTriangleMeshShape* trimeshShape = ...;
btTriangleInfoMap* triangleInfoMap = new btTriangleInfoMap();
//now you can adjust some thresholds in triangleInfoMap if needed.
//btGenerateInternalEdgeInfo fills in the btTriangleInfoMap and stores it as a user pointer of trimeshShape (trimeshShape->setUserPointer(triangleInfoMap))
btGenerateInternalEdgeInfo(trimeshShape,triangleInfoMap);
Code: Select all
static bool CustomMaterialCombinerCallback(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
{
///make sure colObj0 is the triangle mesh
if (enable)
{
btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1);
}
}
Feedback is welcome,
Thanks,
Erwin