Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm drawing a heightfield as a piece of 3D terrain using the fairly 'dumb' method of drawing triangles, like everyone does when learning this sort of thing. There's no fancy LOD, scenegraphs or other things, it's deliberately simple and low poly because that's the look of the game. A section of X,Y height data is turned into a mesh of triangles and drawn on the screen.

I now want to scroll the heightfield in the Z axis (not the X or Y, I just want to move 'forwards' through it).

I have a player object with a 'camera' attached to it. When the player wants to go 'forwards' should I

  • keep the player at the same Z position and scroll the terrain towards the viewer to simulate movement
  • actually move the player in the Z axis and draw the relevant bit of terrain under them (because the camera is 'attached' to the player it looks like they stay in the middle of the screen, and the gameworld and gameplay will limit how far the player can go forwards)

I'm doing the first one at the moment and it works well... until I want to interact with the terrain or place stationary objects on it at specific points. It seems a bit backwards since all the 'moving' objects stay still, and all the stationary objects need to be moved towards the viewer at the same rate as the terrain is. Also the maths to translate the terrain's scrolled amount and the player's pretend location is somewhat complex.

share|improve this question
add comment

1 Answer

I would recommend the 2nd option. With it, you are only updating one item (the position of the player). Whereas in the 1st option, you must update the position of every other object in the world.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.