Correct order of tasks in each frame for a Physics simulation
- by Johny
I'm playing a bit around with 2D physics. I created now some physic blocks which should collide with each other. This works fine "mostly" but sometimes one of the blocks does not react to a collision and i think that's because of my order of tasks done in each frame.
At the moment it looks something like this:
function GameFrame(){
foreach physicObject do
AddVelocityToPosition();
DoCollisionStuff(); // Only for this object not to forget!
AddGravitationToVelocity();
end
RedrawScene();
}
Is this the correct order of tasks in each frame?