diff --git a/bullet/physic.cpp b/bullet/physic.cpp index 76dabce5d9..733216cc17 100644 --- a/bullet/physic.cpp +++ b/bullet/physic.cpp @@ -219,6 +219,13 @@ namespace Physic RigidBody* body = RigidBodyMap[name]; if(body != NULL) { + broadphase->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); + std::map::iterator it = PhysicActorMap.begin(); + for(;it!=PhysicActorMap.end();it++) + { + it->second->internalGhostObject->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); + it->second->externalGhostObject->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); + } dynamicsWorld->removeRigidBody(RigidBodyMap[name]); } }