Skip to content

Commit

Permalink
Merge pull request #248 from GinjaNinja32/ECS-fixes
Browse files Browse the repository at this point in the history
Step physics world after updating its data, rather than before
  • Loading branch information
daid authored Aug 30, 2024
2 parents 909896e + dd1615f commit e0e500a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/systems/collision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ void CollisionSystem::update(float delta)
world = new b2World(b2Vec2(0, 0));
if (delta <= 0.0f)
return;
world->Step(delta, 4, 8);

// Go over each entity with physics, and create/update bodies if needed.
for(auto [entity, transform, physics] : sp::ecs::Query<Transform, Physics>()) {
Expand Down Expand Up @@ -109,6 +108,8 @@ void CollisionSystem::update(float delta)
physics.angular_velocity_user_set = false;
}
}

world->Step(delta, 4, 8);

// Go over each body in the physics world, and update the entity, or delete the body if the entity is gone.
auto now = engine->getElapsedTime();
Expand Down

0 comments on commit e0e500a

Please sign in to comment.