Sorry if I'm missing something obvious but I'm having trouble integrating the bullet Internal Edge Utility into my Bullet / Ogre3d project.
As a quick background, I have a World wrapper that is in charge of initializing physics and keeps track of entities in the world. When I create an entity, I create a physics rigid body for it in a wrapper i call PhysicsModel.
I tried putting the following code in both my World.cpp (where physics is initialized) and in PhysicsModel (where I make the rigid body) and nothing is happening:
Code: Select all
static bool CustomMaterialCombinerCallback(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0, int index0, const btCollisionObject* colObj1, int partId1, int index1) {
std::cout << "Internal Edge Collision" << std::endl;
btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1);
return true;
}
extern ContactAddedCallback gContactAddedCallback;
Code: Select all
gContactAddedCallback = CustomMaterialCombinerCallback;
Code: Select all
if(type == "trimesh") {
body->setCollisionFlags( body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
btTriangleInfoMap* triangleInfoMap = new btTriangleInfoMap();
// Some testing ground for tweaking our trimesh collision
triangleInfoMap->m_edgeDistanceThreshold = 0.01f;
triangleInfoMap->m_maxEdgeAngleThreshold = SIMD_HALF_PI*0.25;//edge angles above this value are ignored
btGenerateInternalEdgeInfo((btBvhTriangleMeshShape*)shape, triangleInfoMap);
}
If anyone knows which class should contain the callback and how I might be using it incorrectly, I would greatly appreciate it, as this internal edge bouncing has been a big issue for our project.
Thank you!