← Back to projects

2D Rigid Body Physics Sim

A small rigid body physics simulator

C++OpenGLGame Physics

 

For my "Physics For Games" unit at AIE, we were tasked with making a basic 2D rigid-body physics engine.

The engine was built on top of Line Renderer, a simple 2D OpenGL renderer authored by my teacher, Finn Morgan. You can download Line Renderer on Finn's website.

If you don't use Visual Studio and can't be bothered setting up the CMake configuration yourself, I have a template repo here using the SDL version.

The physics engine itself handles OBBs, circles and plane primitives with both linear and rotational collision resolution. The resolution uses Gauss-Seidel to resolve the collision iteratively. Using Gauss-Seidel also allowed me to add basic friction.

The engine is quite basic, and has a few limitations. These are explained in more detail on the Github page.

The Github page for the engine can be found here.

Here is a video demoing the engine: