I have a pixel-perfect collision detection system that uses a bitmask for loaded sprite images and checks for overlap in the binary digits using a kind of bitwise analysis algorithm.
It works quite nicely, and it only has to run when the cheap bounding box collision code returns a valid collision area.
The bounding box collision code computes the collision area between the two entities’ bounds and returns null if there is no collision.
The problem I have now is how to resolve these collisions. If I’m updating a moving ball 20 units per tick, I don’t want it moving 10-15 units into another entity and being rendered before bouncing or stopping (obviously).
What’s the best method with this kind of pixel-perfect collision to resolve collisions? The best idea I’ve come up with so far is a simple loop to guess and check until you get as close as needed to the collision location, but this seems kind of risky and would most likely scale quite poorly. Any other ideas?
Thanks in advance for your help!