Collision detection
Collisions are a fundamental part of this simulator. Each object (entity) is defined by a shape given its model (vertices and indices, e.g. from an .obj file). However, collisions on arbitrary objects are hard and expensive. Thus, it is common to do collisions on pure mathematical primitives, such as rectangles (boxes in 3D) and circles (spheres in 3D). It turns out that most of the math works just as well in 2D as it works in 3D, and usually we only have to add one extra condition on the third dimension, symmetric to the 2D condition(s). For this reason, we'll reason about collisions in 2D as much as possible and then discuss the extension to the 3D case.
We'll start with non-oriented primitives: circles and (axis aligned) rectangles. Then, we'll expand to the case where the objects are also oriented.
Circle - Circle
TODO
- the basic idea
- pseudo-code
- 3D case
Circle - Rectangle
TODO
Rectangle - Rectangle
TODO