Correct order of tasks in each frame for a Physics simulation
Posted
by
Johny
on Game Development
See other posts from Game Development
or by Johny
Published on 2013-10-29T07:27:59Z
Indexed on
2013/10/29
16:14 UTC
Read the original article
Hit count: 307
physics
|architecture
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?
© Game Development or respective owner