When to detect collisions in game loop
Posted
by
Ciaran
on Game Development
See other posts from Game Development
or by Ciaran
Published on 2012-03-19T18:01:19Z
Indexed on
2012/03/19
18:15 UTC
Read the original article
Hit count: 438
My game loop uses a fixed time step to do "physics" updates, say every 20 ms. In here I move objects. I draw frames as frequently as possible. I work out a value between 0 and 1 to represent the proportion of the physics tick that is complete and interpolate between the previous and current physics state before drawing. It results in a smoother game assuming the frame rate is higher than the physics update rate.
I am currently doing the collision detection in the physics update routine. I was wondering should it instead take place in the interpolated draw routine where the positions match what the user sees? Collisions can result in explosions by the way.
© Game Development or respective owner