Skip to content
Spacetime in Your Browser: A General Relativity Sandbox Built with BabylonJS

Spacetime in Your Browser: A General Relativity Sandbox Built with BabylonJS

Drop planets onto a deformable spacetime grid and watch gravity warp the mesh in real time. Built with BabylonJS and Ammo.js physics, Hitesh Sahu's simulation turns the rubber-sheet analogy into something you can actually play with. Collision sounds included.

Details

Published

What it is

Hitesh Sahu, a senior developer at Thoughtworks, built a spacetime sandbox and put it in your browser. His General Relativity Physics Simulation lets you drop planets onto a grid and watch gravity do what gravity does: warp the fabric underneath, pull neighbors into wobbly orbits, and occasionally swallow things whole. It's the rubber-sheet analogy from your physics textbook, except the sheet actually moves, the masses have PBR materials that catch light like real objects, and collisions make satisfying little sounds when worlds meet. You place things. The universe responds. There is something deeply pleasing about that loop.

Under the hood, this runs on BabylonJS with Ammo.js handling the physics simulation. That pairing does a lot of heavy lifting here. The spacetime mesh deforms in real time based on mass proximity, which means the grid isn't decorative; it's doing actual work, visually encoding gravitational potential as surface curvature. The collision audio is a nice touch that most physics demos skip entirely. It's a small detail that makes the whole thing feel less like a visualization and more like a toy in the best possible sense.

Go ahead and give it a whirl. Drop planets onto a deformable spacetime mesh and watch gravity do its thing.

How it’s made

Framework & Tool
Babylon.jsAmmo.js
Interaction
Audio
Subject
Space