Jump to content
  • Advertisement
Sign in to follow this  
ZeRaW

Simple Terrain Collision Detection

This topic is 4493 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 implementing an Octree for terrain collision. Then i thought why would i need an octree, a quadtree can do the job. as i am only dealing with terrains. so the structure of the octant leaf will hold the faces that octant intersects and the maximum height ( maximum Y ). the quadtree will be on the XZ plane. and we do not check an octant if we are above the maximum height. simple. After some implementation I came up with even a better idea (i suppose). Instead of a quadtree, i divide the 2D Grid into Tiles. So it will be a simple Tile system. each tile holds the list of faces it intersects with (xz plane only) and the maximum height. Now, this will make it very easy to test the collision. If i want to check if a point intersects the terrain. I will simply transform it to the tile's coordinate system. If it is above the maximum height => no collision. Else we check it with the faces in that tile... Well i said point in the above, it can be a bbox we check with the faces. simply a matter of changing from world coordinate to tile coordinate. Still implementing this but i think it would work with my project (a flight simulator). I would really like to know if i did not thing of something and what i said above is useless.

Share this post


Link to post
Share on other sites
Advertisement
If your terrain is a heightmap you should be able to set up a faster collision detection with some simple lookups.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!