I have been trying deleting rigid bodies during simulation and it always crashes my application. I followed the below code.
Code: Select all
void destroyBodies(btDiscreteDynamicsWorld* dynamicsWorld, btRigidBody* body)
{
dynamicsWorld->removeRigidBody(body);
delete body->getMotionState();
delete body;
}