Using the Internal Edge Utility

kelano
Posts: 2
Joined: Wed Nov 09, 2011 11:04 pm

Using the Internal Edge Utility

Post by kelano »

Hello!

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;
I also put the following line in the class that I add the above code to:

Code: Select all

gContactAddedCallback = CustomMaterialCombinerCallback;
As a side note, when I create a trimesh I use the following code that I have found numerous times:

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);
}
Whether I put the callback in my World or PhysicsModel, my robot still seems to bounce over triangle boundaries. Also my print doesn't get printed, but I'm not convinced that is a good telling sign of whether or not it is working.

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!
abes
Posts: 1
Joined: Mon Mar 05, 2012 5:04 pm

Re: Using the Internal Edge Utility

Post by abes »

Did you have any luck? Are you using a ray-cast vehicle or wheels? I ask because I've been trying to get something to work with wheels. If I use a a primitive model, then the vehicle runs smoothly. However, if I try changing the terrain model to a trimesh the vehicle's ride becomes extremely bumpy (it appears to happen at each vertex).

I also tried using the internal edge utility with no success. I've seen other posts that also seem to have problems getting the utility to work.