What about this:

  • Trace around the edge of the image to produce a polygon data structure
  • First do a simple radius (or square) check to see if your "near", this is your non-precision check.
  • If you're near, then do a 2D line intersection check along the poly points. This will be the precision check. If you get a intersection you've collided and now have the hit pos that can be used for other things.
  • Way faster than pixel perfect for example and very accurate as compared to a radius/square check. This turned out to work very well for me.


[br]The algo for tracing the sprite was a mind twist and took a very long time to get working. In the end a guy I met on line from Russia help me to finally get this working and it formed the basis of the PolyPoint collision system in Quantum Engine. There are a few params that allow fine tuning of the algo (alpha threshold, stepback, etc). All in all, the algo can auto trace a very complex shaped image. It's tightly integrated with my engine at this point and pulling it out is not as easy any more without a lot of dependencies.

However, maybe if you make a tool that will allow you to lay down line segments around your mage and save out this data, then you can apply the same steps outline above for collision detection. At least it's another option to explore.

Update: I see arthurprs has a convex hull algo working. There is the polygon data that you can use.