Pixel Perfect Collisions

Issue #20 wontfix
Chris Logsdon
created an issue

So, BitmapData has a method called hitTest(). I did not know this, and I believe if we were to utilize this, we could have slanted and irregularly-shaped platforms.


Of course we need to consider time restraints and such, but that's why this is a proposal. What do you think?

Comments (3)

  1. Jake Albano repo owner

    This is good to know; I might be able to get rid of the collision hulls. However, this wouldn't give us the ability to have sloped platforms. We'd be able to detect collision perfectly, but not resolve it.

    Since bounding boxes are constructed from the minimum and maximum extremities of an object, if the man was standing on the lower side of a sloped platform he would be pushed out a distance equal to the half-width of the bounding box, not the actual bitmap. To correctly solve collision on non axis-aligned shapes, we'd have to use the separating axis theorem.

    If we're on track to release ahead of schedule, I'll see if I can get it working, but I don't think it's very likely. :/

  2. Jake Albano repo owner

    I did some poking around in the source code and it looks like collision hulls are here to stay. In addition to detecting collision, they're also the way I determine overlap size.

  3. Log in to comment