Jump to content

View more

Image of the Day

The beast has a mighty searchlight of evil! #screenshotsaturday https://t.co/bzKepOojDL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

NeHe's Tutorial 35, Height Map question..

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 HellRiZZer   Members   

308
Like
Likes
Like

Posted 12 October 2001 - 12:23 AM

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.

#2 CheeseGrater   Members   

122
Like
Likes
Like

Posted 12 October 2001 - 03:10 AM

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




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.