The most important theorem to know is the Separating Axis Theorem (SAT). Basicly, it allows you to detect collision between two convex polygons. A good reading material is here.
If your game only concerns with convex shapes, then sat.js
is a decent choice.
However, if you need to work with concave shapes, you need to other algorithms. You can decompose a concave shape into several convex shapes, poly-decomp.js
can do it for you.
This paper is very interesting if you want to dive deeper.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…