Triangle/Triangle 2D Collision Detection at Any Angle

Started by
4 comments, last by Jacob Roman 17 years, 5 months ago
I've been searching for code on this for months, but I want to be able to have a function that accurately determines whether a collision has occured between two triangles (or even more for multiple collisions) in 2D at any angle. I also want to be able to do this with Quads. Been mainly testing quads though, and so far, everything I've tried has failed or was way off. Does anyone have any code that tests collisions on these polygons in 2D?
Advertisement
Whoops. Apparently I posted the same thread twice by accident trying to get it through with gamedev having server issues. Nothing a mod can't handle. :p
Separating axis theorem (SAT). Check out this thread for links to some tutorials and references.
Here is a demo I did some time back, it uses the algorithm from PollyColly, but I can't seem to find the link.
http://www.adamwlarson.com/downloads5.html
Adamhttp://www.allgamedevelopment.com
specifically,

http://members.gamedev.net/oliii/satpost/DXInputs.cpp
http://members.gamedev.net/oliii/satpost/DXInputs.h
http://members.gamedev.net/oliii/satpost/ConvexPolygonCollision.cpp

Everything is better with Metal.

Thanks for the algorithms you guys. I gotta convert them into another programming language though, but besides that, I'm being lead into the right track for a change. I'll be back if I run into problems.

This topic is closed to new replies.

Advertisement