Balls

Ball pit simulator

Click and drag to interact.

Click here for a full-screen demo.

The full source can be found on Github.

This first version of “Balls” came around September, 2010. My goal was to make a ball-pit physics engine that was fast and robust.

Since then, I’ve iterated on the algorithm to include major improvements. The first version used a grid-based partitioning to reduce the number of checks between ball-pairs for collisions.

The following versions included changes to the timestep (from dynamic to fixed) and the integration.

The simulator can handle up to 1600 simultaneous balls in real time on my laptop.

Gallery

Click to view