An interactive 2D physics sandbox built from real magnetic dipole equations. Place magnets, watch them snap together, enable field-line streamers, and explore how different materials behave.
Each magnet is two point charges — a North pole and a South pole at opposite ends. Force between any two poles:
Why they stick: Nearly-inelastic collision (COR = 0.05) absorbs 95% of impact energy. The magnetic potential well holds them together.
Why they don't go crazy: High angular damping (DAMP_W = 0.70/frame) kills spin runaway from torque asymmetry. Confirmed fix from Bullet/Box2D physics research — angular damping is the critical stabilizer.
Steel ball/plate: Ferromagnetic — attracted toward field gradients (∇B²).
Bismuth: Diamagnetic — genuinely repelled. Strongest diamagnetic pure element.
Copper: Eddy current braking — opposes magnet motion proportional to B²×v.
| Input | Action |
|---|---|
| Click toolbar | Select object to place |
| Click canvas | Place selected object |
| Drag | Move object (throw on release) |
| Right-click | Delete object |
| Dbl-click coil | Flip electromagnet polarity |
| Pin → click | Lock / unlock object |
| Force slider | Scale all forces ×0.2–×3.0 |
| Hover toolbar | Material info tooltip |
v1.1 · Single HTML file · ~55kb · No frameworks · 2026