Sign in to follow this  
SomeNoob

Collision detection against curves or other complex shapes and bitmaps.

Recommended Posts

SomeNoob    102

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
Waterlimon    4398

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
wodinoneeye    1689

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this