I'm currently working on a surgical simulator and am using the OGRE engine for rendering and Bullet for the soft body physics. I was looking into mesh cutting. For testing purposes, I've imported the surgical tool mesh and made it a kinematic body and the organ mesh as a soft body. After looking at the Bullet soft body demo code and some of the glue/fracture code (http://code.google.com/p/bullet/issues/detail?id=90), I created the following internal tick callback function:
Code: Select all
void cuttingCallback( btDynamicsWorld *world, btScalar timeStep )
{
int numManifolds = world->getDispatcher()->getNumManifolds();
for( int i = 0; i < numManifolds; i++ )
{
btPersistentManifold *currentManifold = world->getDispatcher()->getManifoldByIndexInternal(i);
if(!currentManifold)
continue;
for( int p = 0; p < currentManifold->getNumContacts(); p++ )
{
btVector3 hitPoint = currentManifold->getContactPoint(p).getPositionWorldOnA();
ImplicitSphere iSphere(hitPoint,10);
Globals::psb->refine(&iSphere,0.0001,true);
}
}
}
This is just a test function to make holes in the soft body. It doesn't seem to work. I've disabled gravity so that the objects just float in space. Does anyone have any idea what could be wrong? Any help would be appreciated. Thanks.