Sign in to follow this  
Feadur

Calculate terrain height without heightmap

Recommended Posts

Hi all, Until know, i've been generating my terrain with typical heightmaps (taking a bmp file, and storing it's pixel info), and that's perfect, but the problem come when I want to use a mesh to draw my terrain. How can i get the heigh (Y) of a given point (X,Z) to make the other objects follow the terrain? Is it necesari to create a height info array? Or is there any collision method (it would be easier) I could use? Thank's!

Share this post


Link to post
Share on other sites
Thank's boldyman .

I know how to detect ray collision with a plane (actually, I'm using it to move my model around with the mouse and pick objects) but, the great problem for me is...how to get a list of triangles of the mesh?

Do I need to read all the VertexBuffer and checkk collision again each triangle?

Share this post


Link to post
Share on other sites
I've been looking at it now and BoundingSphere has a method called Intersect which test collision agains a Ray. But it return a float?, so, is this the distance from the origin of the ray to the intersection point? And also, if I use the bounding box or sphere of the mesh I'm using as terrain, would happen that the model want to test collision with is always inside the bounding box (or sphere)

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