- Home /
How to move the world/scene not the player - or not?
How would I move the world/scene past the player, so that I can do a streaming environment like Temple Run? The reason I want to do it this way is because of round errors once numbers get really large in the world. I've heard that objects behave strangely when getting to far away from the origin. I've certainly encountered this with DirectX.
The other idea if this is not wise, would be move the camera and player over the path, and on the corner turns snap everything back to 0,0,0 with a relative offset between draw cycles.
Which is better? I would like to know how to move the world though.
Answer by PsychoPsam · Aug 26, 2012 at 12:51 AM
I think I just figured out my own answer - silly me. Here's the pseudo code. Does this sound about right?
Work out player velocity vector.
Iterate through all objects in the scene and move them inverse to the players velocity vector.
Add objects on a regular basis (timed).
Remove objects once player has run past them.