• Advertisement
Sign in to follow this  

How do I Follow Terrain height

This topic is 3989 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
You can use a raypick and reduce the number of the triangles you need to test against by using a quadtree for example.

Share this post


Link to post
Share on other sites
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