Original Post
I might just be being stupid, if this is a case, please feel free to form an orderly queue to hit me with a large stick.
Any the Problem!
I have created a 3D terrain with various hills and want my player (the camera) to maintain an height above the hilly surface as you move using the keys etc.
To do this, which may or may not be the best way...if not someone say a better.
As I plotted my vertices forming a grid like matrix, I grab every other four set of vertices and get the average Y (height) coordinate and stuff them into a member variable (using classes).
The Grid is formed of 10 colums by 10 rows each tile (cell) is 10 world units. These values are variables and can be changed.
The camera moves 0.5 world units per frame in the selected direction if any.
Sounds logical..so far dont it?
Right, I then created a metho to which takes two arguments of type float, which are the X and Z coordinates of the camera.
From this I need to determine, which element of my array containing the surface elements should be used.
Note that there is not a one to one relationship here.
As there are like 10 world units per cell the player can move like 20 (0.5 world units per movement) and still be on the same cell.
I have been trying for like 3 days on what at first seemed like a simple problem. I have now pulled out all of my hair....someone please help......