diff options
Diffstat (limited to 'src/core/zone.cc')
-rw-r--r-- | src/core/zone.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/core/zone.cc b/src/core/zone.cc index 8a8c056..a38959f 100644 --- a/src/core/zone.cc +++ b/src/core/zone.cc @@ -127,6 +127,7 @@ Zone::Zone(std::string const & label) : Label(label) zone_bullet_cache = new btAxisSweep3(worldAabbMin, worldAabbMax, maxProxies); zone_bullet_world = new btDiscreteDynamicsWorld(Physics::dispatcher(), zone_bullet_cache, Physics::solver(), Physics::configuration()); + zone_bullet_raycaster = new btDefaultVehicleRaycaster(zone_bullet_world); // disable gravity zone_bullet_world->setGravity(btVector3(0.0f, 0.0f, 0.0f)); @@ -151,6 +152,9 @@ Zone::~Zone() zone_content.clear(); + if (zone_bullet_raycaster) + delete zone_bullet_raycaster; + if (zone_bullet_world) delete zone_bullet_world; @@ -172,19 +176,12 @@ void Zone::print() void Zone::add(Entity *entity) { zone_content.push_back(entity); - if (physics() && entity->body()) { - physics()->addRigidBody(entity->body()); - entity->reset(); - } } void Zone::remove(Entity *entity) { for (Content::iterator it = zone_content.begin(); it != zone_content.end(); it++) { if ((*it) == entity) { - if (physics() && entity->body()) { - physics()->removeRigidBody(entity->body()); - } zone_content.erase(it); return; } |