From 32b475432f3e1c8d7275d17da0d692c173f30478 Mon Sep 17 00:00:00 2001 From: gugus Date: Wed, 23 Mar 2011 22:49:23 +0100 Subject: [PATCH] fix the bug when changing cell. --- bullet/physic.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bullet/physic.cpp b/bullet/physic.cpp index 070f31779..986b57be5 100644 --- a/bullet/physic.cpp +++ b/bullet/physic.cpp @@ -247,13 +247,13 @@ namespace Physic RigidBody* body = it->second; if(body != NULL) { - broadphase->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); - std::map::iterator it = PhysicActorMap.begin(); - for(;it!=PhysicActorMap.end();it++) + // broadphase->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); + /*std::map::iterator it2 = PhysicActorMap.begin(); + for(;it2!=PhysicActorMap.end();it++) { - it->second->internalGhostObject->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); - it->second->externalGhostObject->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); - } + it2->second->internalGhostObject->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); + it2->second->externalGhostObject->getOverlappingPairCache()->removeOverlappingPairsContainingProxy(body->getBroadphaseProxy(),dispatcher); + }*/ dynamicsWorld->removeRigidBody(RigidBodyMap[name]); } } @@ -268,9 +268,8 @@ namespace Physic if(body != NULL) { delete body; - RigidBodyMap[name] = NULL; - RigidBodyMap.erase(it); } + RigidBodyMap.erase(it); } } @@ -322,9 +321,8 @@ namespace Physic dynamicsWorld->removeCollisionObject(act->internalGhostObject); dynamicsWorld->removeAction(act->mCharacter); delete act; - PhysicActorMap[name] = NULL; - PhysicActorMap.erase(it); } + PhysicActorMap.erase(it); } //std::cout << "ok"; }