All work

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.

Role
Sole developer
Stack
UnityC#Bezier curves
Verify
Play on Unity Play ↗
Three masses on black, field lines fanning out from each, coloured from green where the field is weak to red where it is strong

Gravitational field-line simulator · the story

Field lines that bend the way they should, not the way a textbook draws them.

Scroll

2023
shipped on Unity Play, made in school
Bezier
smoothed lines, no visible kinks
Real-time
spawn a mass, the field redraws
C#
Unity, WebGL build

Two masses, one field.

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.

Straight from the build.

Captured from the WebGL version

Spawning masses with S; the field settles around each one
Scaling a mass with + and −; the lines tighten and loosen
Zooming out with the scroll wheel; the whole field in view

Play it yourself on Unity Play, keys S, D, +, − and the scroll wheel

How a line is drawn

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

How it was built.

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

Next project

Microfluidics droplet reactor

A droplet-based lab-on-a-chip with a four-channel Arduino-controlled peristaltic pump system. Designed to bring accessible microfluidics into educational labs without a cleanroom.

Next page