Code: Select all
for (int iii = getGameState()->mDynamicsWorld->getNumCollisionObjects() - 1; iii >= 0; iii--)
{
btCollisionObject *obj = getGameState()->mDynamicsWorld->getCollisionObjectArray()[iii];
btRigidBody *body = btRigidBody::upcast(obj);
if (obj == mbtCar && body && body->getMotionState())
{
getGameState()->mDynamicsWorld->getPairCache()->cleanProxyFromPairs(body->getBroadphaseHandle()
, getGameState()->mDynamicsWorld->getDispatcher());
while (body->getNumConstraintRefs())
{
btTypedConstraint *constraint = body->getConstraintRef(0);
getGameState()->mDynamicsWorld->removeConstraint(constraint);
delete constraint;
}
delete body->getMotionState();
getGameState()->mDynamicsWorld->removeRigidBody(body);
}
}
delete mVehicleRaycaster;
delete mVehicle;
This seems similar to http://www.bulletphysics.org/Bullet/php ... ?f=9&t=696