Collision Detection with concave-Polygons
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
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
Greetings,
I just implemented this myself. This article describes everything you should need:
http://www.gamasutra.com/features/200002...der_01.htm
Cheers,
Rocco
I just implemented this myself. This article describes everything you should need:
http://www.gamasutra.com/features/200002...der_01.htm
Cheers,
Rocco
Virus Out
Big Bang Board Games
Adventures on Pirate Isle
Solace - Strategy, War, and Glory!
The Belt
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
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 | 586 |
May 12, 2013 08:02 PM Last Post: SethWillits |
|
| Collision detection tutorial | ThemsAllTook | 7 | 18,820 |
Nov 5, 2011 05:20 PM Last Post: SethWillits |
|
| Cutting and Splitting Polygons | Maedi | 3 | 5,807 |
Sep 13, 2011 07:40 AM Last Post: Skorche |
|
| Help with Collision Detection..(i'm almost there) | carmine | 1 | 3,602 |
Jun 29, 2011 12:33 PM Last Post: ThemsAllTook |
|
| Time Delta, collision detection | mk12 | 19 | 13,029 |
Sep 8, 2010 06:40 PM Last Post: AnotherJake |
|

