Rotating Heptagon · 20 Numbered Balls

Hand-written 2D circular-body physics: ball↔ball and ball↔moving-wall impulses, restitution, Coulomb friction, spin and air damping. The heptagon turns at exactly one revolution per 5 seconds.

Controls

Space pause / resume  ·  R reset

Live telemetry

Balls20
Wall angle0°
Revolutions0.00
Contacts0
Peak speed0
Max spin0
Sim time0.00 s
Staterunning

Physics constants

Gravity1200 px/s²
Wall spin2π/5 rad/s
Restitution (b‑b / b‑w)0.60 / 0.55
Friction μ0.30
Substeps8 / frame

How it works

  • Each heptagon edge is an infinite-mass wall whose contact point moves at v = ω × r, so bounces use the wall's own velocity.
  • Sequential-impulse solver plus Baumgarte position correction keeps every ball contained and non-overlapping.
  • Friction impulses change angular velocity too, so the printed numbers tumble with each ball.