When to detect collisions in game loop
- by Ciaran
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.