A while back, I created a direct port of
this code, and submitted it to the haxelib repo as "hxcollision".
Today I had a few minutes and updated it to include bug fixes, and new features (like ray/line collision tests).
I figured I will post it here for others to use, here are the
facts:- This is a port of Separating Axis Theorem, for collision detection between shapes, and lines.
- Supports polygons and circles, and line/raycast collisions currently.
- See tests/ for a OpenFL ready test project. Also includes OpenFL drawing class.
- The library itself is not specific to OpenFL.
- COLLISION ONLY. No physics here. By design :)
- Contributions/bugs/requests welcome
Other notes :
- This was a direct port, a lot of the code is a bit untidy and definitely needs cleanup. I plan to do this in the near future.
- The library appears to be stable with rotated polygons and all that, just be aware of "order of operation" between translation, scale and rotation. Rotating after a translate will rotate around the origin still.
- Create issues on the github page for bugs, or features etc.
- Tested in flash, android, iOS, mac, html5