Jump to content
  • Advertisement
Sign in to follow this  
SomeNoob

Collision detection against curves or other complex shapes and bitmaps.

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

Ok so I am new in game development and for simple games bounding box collision is fine. However, let's say you have a shape or bitmap like this:

QkpjT.jpg

Now this is just an example but if you had more elaborate curves or even a whole shape which was more complex than a simple polygon or rectangle-like shape, how would you do precise collision detection? And I am strictly speaking in 2D here. I just want to know the concept behind how you would do this. Thanks!

Share this post


Link to post
Share on other sites
Advertisement

You would either represent it as a collection of simple collision primitives (circles, boxes etc.) that are scaled and rotated to approximate it well, or you would approximate it as an arbitrary polygon (which the physics engine could triangulate or just do physics based on the polygon edges or whatever works the best)

 

Check some 2D physics engine and see what features it has.

Share this post


Link to post
Share on other sites

There is a thing called 'lazy evaluation'  where for the bulk of the collision interactions you use a fairly crude evaluation method (like AABB axis aligned bounding boxes) to validly eliminate most (hopefully vast majority) of the candidates for the collision test,  leaving the remainder to be subjected to the much more processing -intense (but accurate) methods.      

 

Eample is a human figure object maintaining a AABB box that encompases every extremity and then being used to filter out obvious misses of projectiles,  but then if passed proceding to a more accurate piece by piece (figure mesh) testing can then be done to be fully accurate (or as accurate as needed for the games mechanics).  Thus eliminating alot of unncecessary and game performance sapping processing.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!