Separating Axis Collision Detection - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Separating Axis Collision Detection (/thread-4753.html)
Separating Axis Collision Detection - Joseph Duchesne - Nov 27, 2005 05:07 PM
I've been trying to write a simple separating axis collision detection function between two polygons in C and I can't find any working example code. I don't really care what language it's in, as long as I can run it on my mac and can then port it to C. I'm also simultaneously working on the same thing in Processing, just for testing purposes. You can view the Processing Java Applet here: http://magneon.ath.cx/Test (source file linked from the page) to see what my problem is (the collision is just a little bit off on one side). If anyone has any links or example code lying around I would greatly appreciate it.
Separating Axis Collision Detection - Skorche - Nov 27, 2005 05:21 PM
Separating Axis Collision Detection - Joseph Duchesne - Nov 27, 2005 05:40 PM
Separating Axis Collision Detection - DoG - Dec 22, 2005 09:46 AM
The logical steps are quite simple. You must create a min and max vector of each polygon, and then you check on each x,y, and z that the intervals (don't) overlap. That's the interval test in words.
The intervals don't intersect if (minA >= maxB) || (minB >= maxA). The common range is from max(minA, minB) to min(maxA, maxB). Hope that makes sense. The code for this is real simple, I can post some if you can't figure it out.
Separating Axis Collision Detection - Leisure Suit Lurie - Dec 22, 2005 10:18 AM
Its in visual basic though. HTH.