PDA

View Full Version : Terrain + Heightmap = Arg



c_olin
08-04-2003, 08:16 AM
I'm using a the heightmap code from NeHe, and I have writen my own first person camera code. But... I've messed around a bit but i havent thought of a way to keep the camera 5.5f over the terrain even when the terrain goes higher, because right now, i just go right thru the terrain... how is this done?

thanks in advanced

GlutterFly
08-04-2003, 09:13 AM
Why dont you get the current x and z (assuming y is the height of the terrain) then check the y value associated with the current x and z values. You then do your glLookAt statement using (x, height+5.5f, z, ...)
where height is the y value associated with your current x and z points. I have not looked on the nehe tutorial, but im sure there is a method to acquire this data.