- Home /
Infinite Runner Movement
I am having a hard time trying to decipher in the infinite runner games that are currently out does the player move or does the character move? Mine is going to be in 3D if that helps at all. However, I was wondering what the best practice is to creating a smooth infinite runner, should I move the character or the terrain itself. At first I thought the character, however that would mean the camera would have to follow the character and could resort into some jerky camera movement. Also the problem with moving the character would be, if it is infinite, floating point numbers tend to get skewed at larger values. I am just wondering what is the best practice to accomplish this task. By the way I have an idea about how to go about and complete the game, but I am just trying to figure out what to actually move.
Thanks.
Answer by rutter · Aug 07, 2014 at 04:13 AM
There's a saying in programming: "Do the simplest thing that could possibly work."
Moving your character is easier than moving everything in the scene. A lot faster, too, plus it'll work better with the physics engine.
It's true that floating point error is a concern. But how fast is your character running? 15 units per second? Assuming you're movig in a perfectly straight line, that gives you about two hours before getting 100,000 units away from the origin. If you start at -100,000 units, that's four hours of running in a straight line.
There may be some problems to solve with engineering, but this is probably low on the list.
Answer by subho0406 · Dec 23, 2014 at 08:56 AM
Another method that could be employed is that changing the coordinates of player along with the world to 0,0,0 whenever player is above a particular coordinate limit say 9000unit. The world and player is moved together provided you use a unity skybox there will be no relative motion observed and the coordinates will become 0,0,0 after every 9000m