I'm trying to understand swept-AABB collision detection. When checking for collisions between two positions of an object, I commonly see one of 3 strategies used:
- Rays: trace rays from parts of the AABB at the previous postion to those on the final position, and check for intersection between them and other objects.
- CCD: split the motion into multiple in-between positions, and check each one for collisions.
- No sweep: just check that start and end positions are collision-free, and assume there was no collision in between.
A solution I've not seen discussed is just to use 2 triangles.
Here's how they compare:
The math wouldn't change even if you started using OBBs or convex shapes with more vertices: you still just need 2 triangles.
The above image illustrates the shortcomings of each approach. Only the Polygon conversion test is sure to catch all of the swept region.
From the tests I have done, simple triangle collision in not that costly, though slower than AABB–AABB and sphere–sphere. It seems to cost less than CCD also, but avoids misses (e.g. CCD might miss the red cube in the top left). Rays have a tendency to miss small objects if you imagine moving one of the red cubes up or down in the image.
Are there issues with this technique that would cause it to be used so little?