Physics must be update before entities ?

Hello !
I’m building my tiny 2d game engine with very basics physic features and an Entity-Component system. My question is simple: Wich one should I update first ? The physic world, with all the collision detection and response, or my entities ?

Most systems I have seen will update all of the entities, then step the physics world to resolve collisions. But there is no real right or wrong answer here. Try both and choose the one which works best for you.

okk thanks i will try

I’ll go to UpdateEntities then UpdatePhysics ^ _ ^ y

| = Wall
-> = Bullet

,
SCENARIO A: Physics then Entities

e.UpdatePhysicsWithCollisionReponse
-> |
e.UpdateEntities
| ->
e.Draw
| ->

( Bullet pass the wall, but collision reponse will be corrected on next iteration from, )

.
SCENARIO B: Entities the Physics

e.UpdateEntities
| ->
e.UpdatePhysicsWithCollisionReponse
->|
e.Draw
->|

( Collision response is corrected on drawing bullet hit the wall )

1 Like

Yes, I saw that in other forums to :thumbsup: