• Role: Physics programming
  • When: December 2016
  • Team: Solo, 8 weeks

Physics Engine

A 2D rigidbody physics engine written from scratch inside Unity: integration, collision detection and collision resolution.

  • Unity

01

Overview

This was my first try at making a physics engine. I developed it while working on a game in parallel, Oberon. Making stable stacking that could work in the game within the given timeframe proved to be too ambitious, but even though these physics didn't make it into the game, I'm still very proud of the result.

Boxes falling and stacking in the custom physics engine
01Boxes falling onto each other

02

Rigidbody physics

I learned how to write real-time rigidbody physics: different integration methods, and how forces and impulses affect bodies. I learned about the different stages of a physics step, moment of inertia, torque, and many other things.

03

Collision detection

I wrote the code for collision detection. The game needed only boxes, so I decided to focus on those. My system supports point to edge and edge to edge collision detection.

A box bouncing between walls in the custom physics engine
03A box bouncing off the walls

04

Collision resolution

I learned and implemented collision resolution for this physics framework, along with friction and resting states. I was very close to making stacking work properly, but due to time constraints, I couldn't get it to the quality a game needs.

See the other projects [email protected]