Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Moving a character across hilly terrain

This topic is 5930 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

I was wondering if anyone had any ideas on how this is professionally handled, such as in the 3D Mario and Zelda games. I can think of a way of doing it... using the x and z coordinates of the character, traverse every triangle in the terrain poly mesh until you find the triangle housing the point. Then calculate the y-value for the character''s position based on this triangle. But this solution seems to be very inefficient, especially when the terrain is made up of many, many triangles. Anyone have any suggestions? By the way, I''m just speculating now... I''m planning on using DirectX''s X Files for meshes. Thanks for your replies! Riskbreaker

Share this post

Link to post
Share on other sites
This is close to identiacal to a question I asked here a while ago (if the search function was working, you could just look there but..) Anyway, an easy way to solve this, even if it takes some more memory, is to make a struct called t_Triangle (or something) storing the coordinates of the three corners and the ID's (the array indexes) of the neighbouring triangles in it. That way you only have to traverse four triangles every time you need to calculate the height value (the one you was standing in last time you executed the function and the three neighbouring triangles)

This is an easy way, if you want a more complex and probably more efficient, look up on octrees or bsp-trees.


[edited by - Luctus on September 16, 2002 4:26:19 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!