project thumbnail
Duration 1st: ±7 weeks
Duration 2nd: ±20 weeks
Date first: September-October 2013
Date second: February-June 2014
Tools used: OpenGL
GLSL
Visual Studio 2010
g++/make
Very sleepy

Constraint based physics

I had physics programming in my second year (2012) at IGAD, but the year after that a new teacher started giving different physics lectures for that course. I decided to follow along with the new lectures only as extra course, but I started coding anyway because of my interest in the subject. The new teacher challenged me to make a car drive through a wall after showing off my constraint solver in class. After that he proposed the idea of doing my specialization in constraint based physics simulation (research). The emphasis of this project was readability and experimentation since it is a research project, so is is not fully optimized.

The latest version of the paper about this project can be found here.

Features:

  • Collision detection:
    • SAT convex polyhedron collision.
    • Infinite planes.
    • Spheres.
    • Contact manifold generation for all collision combinations.
  • Solver:
    • Iterative constraint solver based on E. Catto's paper Iterative Dynamics with Temporal Coherence.
    • Simple sparse matrix optimizations.
    • Contact constraints.
    • Friction constraints.
    • Extendable architecture to support more constraints in the future.
  • Unstable torque-free motion.

Video


Demo video

Images

Constraint based physics screenshot 1
Latest iteration of the project showing support for spheres. Also added some better graphics.

Constraint based physics screenshot 2
The wall and the car challenge.

Constraint based physics screenshot 3
Driving through the wall.

Constraint based physics screenshot 4
Shooting a block through the the wall.

Constraint based physics screenshot 5
A collapsed wall, and a car with 3 blocks stacked on top of it.