SPHERE LAB
Realistic 2D ball physics sandbox
Tools
Spawn Click to create a ball. Drag to slingshot. Shift-click for a burst of 10. Shift+hold (optionally while moving) to paint-spawn balls continuously.
Grab Pick up and fling balls. Velocity = how fast you dragged.
Draw Click-drag to draw a static wall segment.
Erase Remove balls, walls, or links near the cursor.
Link Click two balls to connect them with a spring. Re-link same pair for reinforced strands. Drag through many balls to chain-link them all in one stroke. Ctrl+click-hold a ball to auto-mesh — link it to every nearby ball, repeatedly while held (drag outward to grow the radius). Shift+click target to keep source selected for rapid spoke-linking; Shift+click-hold on a target to spam reinforcement strands.
Pin Click a ball to toggle whether it's fixed in place.
Push Hold to push balls radially away from the cursor.
Attract Hold to pull balls toward the cursor.
Heat Paint heat onto balls — changes color, elasticity, friction.
Controls
Right-click Explosion force at cursor.
Middle-drag Pan the camera.
Wheel Zoom in/out (at cursor).
← → Actuate pinball flippers (in PINBALL scene).
Ctrl-Z Undo last spawn / wall / link.
1-9 Select a material.
Q W E R T Y U I O Select a tool.
Space F G C Pause · Slow-mo · Gravity · Clear.
B V S H M Bloom · Vectors · Sound · Heat · Motion-blur.
Ctrl-R / 0 Reset scene · Reset camera.
Physics model
240 Hz fixed-timestep simulation with continuous collision detection.
Ball contacts use a warm-started sequential-impulse solver: each
contact reuses last frame's accumulated impulse, friction is clamped to a
proper Coulomb cone against the accumulated normal impulse, and
penetration is removed by an energy-free split-impulse (NGS) position
pass — so stacks and granular piles stay rock-solid instead of jittering.
Settled contacts sleep as islands. Tangential friction transfers linear
momentum into spin; spring + pendulum constraints resolve iteratively.
Newtonian N-body gravity (Orbits) and a particle fluid with
surface-tension cohesion + viscosity (Fluid / water) build on the same
core. Materials carry density, restitution, friction, conductivity and
more — heat conducts on contact and modifies elasticity. Buoyancy follows
Archimedes, helium lifts, Magnus curves spin, antimatter annihilates, and a
uniform spatial hash keeps broadphase O(n) on average. The
Solver slider sets iteration count; the Warm toggle shows the
difference warm-starting makes.
Rendering
Gradient sphere shading with a metallic branch (env reflection bands) and a
diffuse branch. Glass balls refract the current scene snapshot through an
inverse lens. Half-resolution bloom buffer, chromatic aberration, film grain,
fake ambient occlusion in contact gaps, motion streaks, lens flares on
glowing sources, and expanding impact rings on high-energy collisions.