Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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.

  • You cannot reply to this topic
3 replies to this topic

#1 ogracian   Members   -  Reputation: 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

Sponsor:

#2 Arsenal   Members   -  Reputation: 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
Lead Developer
2Real Entertainment
http://www.2realentertainment.com

#3 ogracian   Members   -  Reputation: 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   -  Reputation:

Likes

Posted 04 October 2001 - 04:03 AM

You can add gravity to your model quite simply.

First, you need to calculate the height of the terrain below points at the front and back of your vehicle (the previous reply has suggested how this can be done). This will allow you to work out the angle that the vehicle needs to be rotated about a horizontal axis to be aligned with the terrain. The component of gravity in the direction that the vehicle is now pointing is given by g.sin(T), where g is the standard acceleration due to gravity and T is the angle between the vehicle in its new alignment and the horizontal.

Good Luck

Paul G.




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.



PARTNERS