Tech
Building a 2D Physics Engine From Scratch: SAT Collision Detection in C++ and SDL2
I wanted to actually understand collision detection — not "call the library function," but understand it well enough to write it myself. So I built a small 2D physics engine in C++ and SDL2, no external physics library, and picked the Separating Axis Theorem (SAT) as the core algorithm.
Here's how it works, and the gotchas I ran into turning "shapes are touching" into "shapes bounce correctly."
Why not just bounding circles?
Circle-vs-circle collision is one line: compare the distance b...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to