Sign in to follow this  
DFlame

How do I Follow Terrain height

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this