i've got a very simple function that uses bullet to check whether 2 objects in my simulation are currently intersecting, it looks like this:
Code: Select all
BOOL doesObjectIntersectWithObject(SceneNode * otherObject)
{
btCollisionObject otherCollisionObject = [otherNode collisionObject];
[... snip ... setup rotations of both objects..]
btCollisionAlgorithm* pAlgorithm = collisionWorld->getDispatcher()->findAlgorithm(&otherCollisionObject, &collisionObject);
btManifoldResult oManifoldResult(&otherCollisionObject, &collisionObject);
pAlgorithm->processCollision(&otherCollisionObject, &collisionObject, collisionWorld->getDispatchInfo(), &oManifoldResult);
btPersistentManifold* contactManifold = oManifoldResult.getPersistentManifold();
if (contactManifold == NULL)
{
pAlgorithm->~btCollisionAlgorithm();
return NO;
}
int numContacts = contactManifold->getNumContacts();
for (int j = 0; j < numContacts; j++)
{
btManifoldPoint& pt = contactManifold->getContactPoint(j);
if (pt.getDistance() < 0.00f)
{
pAlgorithm->~btCollisionAlgorithm();
return YES;
}
}
pAlgorithm->~btCollisionAlgorithm();
return NO;
}
pAlgorithm->~btCollisionAlgorithm();
is called? any ideas? i'm now caching the algorithms as a workaround, but i am sure there must be some better way.
btw this is occurring in 2.77 2.78 and trunk.