2D collisions, passing through

BlitzMax Forums/BlitzMax Programming/2D collisions, passing through

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

A method I'm planning to use in my current 2d project is a kind of a mixture of swept collision detection and pixel perfect collision detection with sprites.

A fast preliminary check is made by imagining two (or more, depending on the width of the moving object) lines between the current and last known coordinates of the object, and checking if any of those lines intersect a circle (or rectangle) representing the object we are checking collisions against. If they do, we'll do a pixel perfect collision check in the intersecting area.

That way I can minimize the amount of slow pixel perfect checks using a fast line-to-circle or line-to-rectangle approximation method.

This trick is still sitting unimplemented on the drawing board, so I'm not yet 100% sure if it'll actually work. ;)