has anyone..

BlitzMax Forums/BlitzMax Programming/has anyone..

Paul "Taiphoz"(Posted 2008) [#1]
got any examples of pixel perfect collision detection between either 1 very fast moving sprite and a none moving one or two very fast moving sprites?


Arowx(Posted 2008) [#2]
No code examples, but I believe that BlitzMax's colllision detection 'masking' system is pixel perfect.

The actual problem is the relative speeds of the objects and their size as any game would simulate their movement at intervals and only check for collision at these intervals.

I can think of a couple of ways of getting around this yourself, e.g.

1. Use the last updated position and combine with the next position to create collision detection rectangles for each object.

2. If two interval rectangles overlap you then need to work out the intersection point based on your two movement vectors.

3. Now you need to move the objects back in 'Time' to when one of them was at this point and check for collision.

Hmmm maybe not, you wanted pixel perfect collision and to do that you would have to use collision rectangles or spheres to work out when 'roughly' the impact occurred then step through the motion a pixel increment at a time until you get both objects overlapping!?

Some further research needed me thinks, would you be able to get away with circles as a rough approximation of the object, you could even overlay a set of circles to represent more complex objects?


Perturbatio(Posted 2008) [#3]
Could you use two vectors to determine if they intersect, then worry about the pixel perfect collision?