I am trying to use Bullet Engine to calculate the least distances between two objects. I do this using contactPairTest. This seems to work with two convex objects at least. However, when I try to find the minimum distance between a convex object and a compound shape, Bullet produces a segmentation fault. I know that Bullet can't compute the positive distance between a convex and a concave shape but seeing that a compound shape is composed of convex shapes, shouldn't finding the least distance between a compound and a convex shape be possible?
Thanks in advance!
Code: Select all
btDefaultCollisionConfiguration collisionConfiguration;
btCollisionDispatcher dispatcher(&collisionConfiguration);
btDbvtBroadphase pairCache;
btCollisionWorld world(&dispatcher, &pairCache, &collisionConfiguration);
world.getDispatchInfo().m_convexMaxDistanceUseCPT = true;
MyContactResultCallback result;
result.drawMinDistance = drawMinDistance;
btCollisionObject obA;
obA.setCollisionShape(bds[nodeID0]->shape);
obA.setWorldTransform(*(bds[nodeID0]->transShapeAbsolute));
btCollisionObject obB;
obB.setCollisionShape(bds[nodeID1]->shape);
obB.setWorldTransform(*(bds[nodeID1]->transShapeAbsolute));
result.collisionWorld = collisionWorld;
cout<<"calculating minimum distance"<<endl;
world.contactPairTest(&obA, &obB, result);