Live · Sep 2023 – Mar 2024
Gravitational field-line simulator
A real-time gravitational field-line simulator. Click to spawn planets, scroll to zoom, watch Bezier-smoothed field lines respond. The first sim I shipped, made in school. Still works.
Live · Sep 2023 – Mar 2024
A real-time gravitational field-line simulator. Click to spawn planets, scroll to zoom, watch Bezier-smoothed field lines respond. The first sim I shipped, made in school. Still works.
Gravitational field-line simulator · the story
Scroll
Sampled on a grid · traced through Bezier curves · coloured by strength
Green where the field is weak, red where it is strong. Add a mass and every line finds its new path.
Captured from the WebGL version
Play it yourself on Unity Play, keys S, D, +, − and the scroll wheel
SAMPLE
the field vector on a 2D grid around every mass
TRACE
step from a seed point along the field, collecting points
SMOOTH
Bezier interpolation through the points, so nothing kinks
COLOUR
green to red by field strength along the curve
REDRAW
every frame, so the field answers the moment you touch it
The first sim I shipped. Still up.
Gravitational field-line simulator · the write-up
I’d seen plenty of field-line plots in textbooks. They were always piecewise — straight little segments approximating a curve. I wanted lines that were actually smooth, that didn’t kink visibly when you traced them out from the source.
So I sampled the field on a 2D grid, then ran Bezier interpolation through the points to draw each line. The result is what you can play with right now: spawn masses with S, delete with D, click to read field strength at the cursor, +/− to scale a planet’s mass by 2× or ½×, scroll to zoom. Works in your browser, no install.
It’s the first sim I shipped — made it in school, polished and put on Unity Play in late 2023. It’s still up. I plan to ship a quantum-mechanics potential-well simulator next, but this one stays as the origin point. Physics curiosity that turned into code that other people can run is the whole reason I’m doing what I’m doing.
End of Gravitational field-line simulator