2D Collision Detection using SAT (Separating Axis Theorem)

preview_player
Показать описание
One of my third year graphics projects. I had to implement exact collision detection between different shapes (some which rotate) by implementing SAT collision detection.

I optimized the collision checks in two ways:
1. I took advantage of spatial coherence by dividing up the area into a rectangular grid and only checking for collisions between objects that lay within the same grid section.
2. I used broad phase detection, to filter out objects prior to performing the SAT collision detection, by using circles as bounding areas.

I implemented my spatial coherence by creating a map of grid indices to the lists of objects held at those indices.
The list contents were then updated each frame.
Collision detection is then only calculated between objects in the same list.
Рекомендации по теме