• Advertisement

Archived

This topic is now archived and is closed to further replies.

NeHe's Tutorial 35, Height Map question..

This topic is 5945 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve been trying to figure out the position of the camera, so it will have same height as the heightmap at given point. E.g if my camera at x=15.0, z=45.0 I want to know y value of the heightmap at that point because the height in it is on y axis. The equation
  
Camera.y=pHeightMap[x + (z * MAP_SIZE)]; // pHeightMap is RAW data

  
does work but very strangely, and it doesn''t follow the height at given point. Sometimes it does, sometimes not. Please help. I need to solve this problem.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by HellRiZZer
I've been trying to figure out the position of the camera, so it will have same height as the heightmap at given point. E.g if my camera at x=15.0, z=45.0 I want to know y value of the heightmap at that point because the height in it is on y axis.
The equation

Camera.y=pHeightMap[x + (z * MAP_SIZE)]; // pHeightMap is RAW data



does work but very strangely, and it doesn't follow the height at given point. Sometimes it does, sometimes not.

Please help. I need to solve this problem.




This works funny because you only have data points at the integers, but you want height data for fractional values as well.

You need to figure out the corners of the 'square' your camera is in, and interpolate the heights from those corners.

Edited by - cheesegrater on October 12, 2001 10:13:19 AM

Share this post


Link to post
Share on other sites

  • Advertisement