A tutorial on implementing a simple C++ rigid body simulator.
The tutorial follows Appendix A from the SIGGRAPH'22 Course on contact and friction simulation for computer graphics.
CMake is used to build the main application. To build and run the code, first create a sub-directory:
> mkdir build
Then, configure the project for the specific build target:
> cd build
> cmake -DCMAKE_BUILD_TYPE=Debug ..
Finally, compile using your favorite build tool or IDE, e.g.
> make
The code has been compiled and tested on Windows (MS Visual C++ 2019), Ubuntu Linux (g++ 9.3 with VS Code), and MacOS (Clang)
The following dependencies are included and compiled automatically (see the 3rdParty directory):
Implementations of a matrix-free Projected Gauss-Seidel (PGS) solver for boxed LCPs (see SolverBoxPGS.h/.cpp)
The CollisionDetect.h class handles collision detection and contact generation for all pairs of simulation bodies. For this tutorial, the following geometries are supported:
- Spheres
- Boxes
And you will implemented collision handling for the following geometry pairs:
- Sphere-sphere
- Sphere-box
Implementation of the box friction cone model (see Contact.h/.cpp).