• Create Account

## Object's following terrain contours?

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.

3 replies to this topic

### #1ogracian  Members

180
Like
Likes
Like

Posted 01 October 2001 - 06:51 PM

Hello I am trying to write an application wich moves an object through a 3D terrain, but my trouble is how can I simulate that my object follow the terrain contours, I mean, if my objects go up a hill, it must be follow the hill's orientation and must slows my object speed, since it is going hill up? Or said in a different way, how can I do to my object match ground slope? Thanks in advance! Edited by - ogracian on October 2, 2001 1:58:04 AM

### #2Arsenal  Members

158
Like
Likes
Like

Posted 02 October 2001 - 02:59 AM

There are tons of ways to do this.

One way is interpolating between terrain triangle vertices to find your altitude (I''m assuming Y). Of course, you must know what triangle you''re "on top" of, which should be easy if the terrain is laid in a grid pattern.

A second way that I have used is using the plane equation of each terrain triangle. Then, given the X and Z of your object''s position, you can figure the Y from the plane equation.

If you want full physics, with gravity, and friction playing on your object, well, then it''s going to get a lot more complicated.

The NeHe Game Development forum on this website will have a lot more information about terrain following.

Hope this helps

Mark Grocki
2Real Entertainment
http://www.2realentertainment.com

### #3ogracian  Members

180
Like
Likes
Like

Posted 02 October 2001 - 06:27 AM

Thanks for your answer, it help me a lot, I will check the NeHe site!

Oscar

### #4 Anonymous Poster_Anonymous Poster_*   Guests

Likes

Posted 04 October 2001 - 04:03 AM