View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Collision detection against curves or other complex shapes and bitmaps.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1SomeNoob  Members

Posted 30 August 2014 - 10:50 PM

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:

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!

### #2Waterlimon  Members

Posted 31 August 2014 - 04:07 AM

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.

o3o

### #3/ slalrbalr   Banned

Posted 01 September 2014 - 12:53 AM

Here's a great article about per-pixel collision detection: http://lazyfoo.net/SDL_tutorials/lesson18/

Edited by tonemgub, 01 September 2014 - 12:59 AM.

### #4wodinoneeye  Members

Posted 30 September 2014 - 03:00 PM

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.

--------------------------------------------Ratings are Opinion, not Fact

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.