height field terrain

i am using a height field to create a terrain. i want the camera to follow the different y values of the x,y,z’s so that it appears that u r running along the terrain. i thought if i just took my x and zs and looked them up in the array of points i would have the height but it didnt work does anyone have any ideas about how i can do this

http://www.vterrain.org/ has lots of code.

Your question has nothing to do with OpenGL; it’s a simple computational geometry problem.

yeah i know it doesnt have much to do with opengl but i didnt know where else to go i checked out that site but couldnt find any programs that would help me out. anymore help is appreciated incus

  1. found the 4 points in the heighmap that are arount the camera (the camera posdition will rarely be exatcty on a pixel of the heighmap).
  2. interpolate

www.gametutorials.com

look into the heightmap tutorials…when you run their program, the camera adjusts to the height of the terrain (which is what i understood you wanted to happen… )

-------------------------- http://nomad.openglforums.com

If you allow steep hills, your camera near plane may still intersect hill sides.

Thus, what you REALLY want is a function to sink a sphere of some radius onto a height field, until it collides with the field (which doesn’t have to be straight under the sphere center). This is a collision detection problem; sphere-triangle intersections will do this but there are possible optimizations.
http://www.codercorner.com/Opcode.htm
http://www.magic-software.com/Intersection3D.html