back

Basic physics engine coded in Lua from scratch

Love2D has box2D fully integrated as a physics engine, but I didn't use it. Love is mostly used for drawing. Notably, triangulation and convex shape checking are important to the code but not implemented by me.

With this project I wanted to figure out how game engines do physics. Turns out it boils down to one formula from actual physics (impulse formula with rotation) and the rest is mostly finding where and how to apply it.

I really could sit here for hours explaining all the cool algorithms that went into this but there are just way too many. I was coming back to this project from time to time implementing whatever I found interesting (This is how soft bodies and the Voronoi diagram you see in the background got there).

There's a release available on github but it is outdated by quite a few commits. You can see everything in the gif though.