Jump to content
  • Advertisement
Sign in to follow this  
ManaStone

OpenGL Is this how terrain collision detection is usually done?

This topic is 5473 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 just got done looking at a height map OpenGL example and it just looks up the height to see if it is below the map for collision detection. Is this how it is normally done in games? I’d think that it might be implemented by doing something that involved using the normals.

Share this post


Link to post
Share on other sites
Advertisement
Checking collision can be done as a quick and dirty height test against a heightfield.

However, if your wanting to do something other than a quick demo I'd go with a more elaborate collision system.

Share this post


Link to post
Share on other sites
as i picture it, normals would be use for collision detection so that objects can either slide (character hitting wall) or ricochet (projectile).

if the demo is just calculating the terrain height, the easiest way to notice would be walking up a hill.

consider these 2 hills

b1
/\
/ \
/ \ b2
a1/ \c1 and a2___/\___c2


a1 to b1 is a longer trek than a2 to b2, but you should notice in your game that it takes no extra time to travel the distance.

there are a several articles dedicated to collision detection. if you can't find any you like, find a book on linear algebra. collision detection usually comes down to just finding the intersection of 2 planes, or a plane and a line, etc.

if you understand these concepts, a simple (but probably not very fast) collision algo is just as easy as solving a system of eqs

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.

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!