commit 2862af0e
Destroy all fixtures for the destroyed bodies
Changed files
| M | src/saland/model/World.cpp before |
diff --git a/src/saland/model/World.cpp b/src/saland/model/World.cpp
index 87a243d..e2a1f5e 100644
--- a/src/saland/model/World.cpp
+++ b/src/saland/model/World.cpp
@@ -89,6 +89,12 @@ static b2Body* AddStaticTilesToWorld(b2World* world, const sago::tiled::TileMap&
void World::init_physics(std::shared_ptr<b2World>& world) {
for (b2Body* b : managed_bodies) {
+ b2Fixture* f = b->GetFixtureList();
+ while (f) {
+ b2Fixture* next_f = f->GetNext();
+ b->DestroyFixture(f);
+ f = next_f;
+ }
world->DestroyBody(b);
}
managed_bodies.clear();