Jump to content
  • Advertisement
Sign in to follow this  
DFlame

How do I Follow Terrain height

This topic is 4112 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

This may sound newby, but given an x,z position on top of a terrain mesh, how do I calculate a height position on the terrain for an object to position on. For example, a car wheel following the height of a road going up and down hills. I was thinking maybe you'd use a raypick, but would that not be computationally expensive?

Share this post


Link to post
Share on other sites
Advertisement
If you have a hightmap compute the corresponding pixels from the position on the terrain. Then use those pixels to calculate the hight and slope at that position. Since a highmap terrain is a regular grid (at least when it comes to collision detection) this is easily done and you'd have to check only 1 or 2 triangles for a basic CD.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!