## Collision Detection with concave-Polygons

mutle
Unregistered

Post: #1
Hi,
I am currently writing an 2D-Action game, which needs me to check for collisions between Polygons and the Players Bounding box.
I currently use an algorythm which adds all the angles from a Point to the various Points of the Polygon. It is true (collides) when the angle is > 360∞.
The problem is, that this algorythm doesn't work with concave Polygons, which are required for my game.
Is there another way to do it, so that it works for concave Polygons too?

Thanks,
mutle
Member
Posts: 204
Joined: 2002.09
Post: #2
Greetings,

I just implemented this myself. This article describes everything you should need:

http://www.gamasutra.com/features/200002...der_01.htm

Cheers,
Rocco
Member
Posts: 304
Joined: 2002.04
Post: #3
well - all concave polygons can be broken down into convex polygons (or triangles) - and then you could collide with those instead. There are some libraries for this (google "triangulation code").

A polygon can intersect with a rectangle - and yet the four corner points of the rectangle are still outside of the polygon - and the vertecies of your polygon are outside of the rectangle - so its possible you will miss collisions - but not likely.

hth

Possibly Related Threads...
 Thread: Author Replies: Views: Last Post Optimize the collision detection alaslipknot 1 4,558 May 12, 2013 08:02 PM Last Post: SethWillits Collision detection tutorial ThemsAllTook 7 25,180 Nov 5, 2011 05:20 PM Last Post: SethWillits Cutting and Splitting Polygons Maedi 3 8,345 Sep 13, 2011 07:40 AM Last Post: Skorche Help with Collision Detection..(i'm almost there) carmine 1 5,578 Jun 29, 2011 12:33 PM Last Post: ThemsAllTook Time Delta, collision detection mk12 19 18,761 Sep 8, 2010 06:40 PM Last Post: AnotherJake