Verlet Physics
Ropes, chains, and the elegance of constraints. Grab, swing, and cut — all simulated with Verlet integration, the same technique behind ragdoll physics and cloth simulation in games.
How it works
What is Verlet integration?
Most physics simulations track both position and velocity. Verlet integration does something different: it stores only the current position and the previous position. Velocity is never stored explicitly — it is implicit in the difference between the two positions.
Each frame, the new position is computed as:
new_pos = current_pos + (current_pos - prev_pos) * damping + acceleration * dt²
This is Stormer-Verlet integration, first used by Loup Verlet in 1967 to simulate molecular dynamics. The beauty is its simplicity: no velocity variable, no half-step calculations. Just positions and the memory of where you were.
Why constraints instead of springs?
You could connect particles with springs (Hooke’s law: F = -kx). But stiff springs require tiny time steps or the simulation explodes. The stiffer you make the spring, the more unstable it becomes.
Constraints take a different approach: instead of applying forces, they directly move particles to satisfy a distance requirement. If two connected points are too far apart, push them closer. Too close, push them apart. No forces, no instability, no explosions.
The satisfy-constraints loop
One pass through all constraints won’t satisfy them all — fixing one constraint may break another. The solution is iterative relaxation: repeat the constraint-solving loop multiple times per frame. More iterations mean stiffer, more accurate constraints. Fewer iterations mean softer, stretchier behavior.
for each iteration (1 to N):
for each constraint:
delta = pointB.pos - pointA.pos
dist = length(delta)
diff = (target_dist - dist) / dist
offset = delta * 0.5 * diff
if (!pointA.pinned) pointA.pos -= offset
if (!pointB.pinned) pointB.pos += offset
This is Gauss-Seidel relaxation — the same technique used to solve systems of linear equations. With enough iterations, it converges to the exact solution.
A brief history
Verlet integration appeared in Loup Verlet’s 1967 paper on molecular dynamics simulations. But the same method had been used by Stormer in 1907 for computing comet orbits, and Newton himself used a similar approach.
The technique entered game development through Thomas Jakobsen’s 2001 GDC talk, “Advanced Character Physics,” which showed how to build ragdoll physics with nothing but Verlet integration and distance constraints. The simplicity was revelatory: no spring constants to tune, no damping coefficients to adjust, no numerical instability to fight.
Applications
Ragdoll physics — character bodies that flop realistically when they die, built from points connected by distance constraints with angle limits.
Cloth simulation — a grid of particles connected horizontally, vertically, and diagonally. The same technique powers fabric in games and film.
Bridge builders — games like Poly Bridge use constraint-based physics to simulate structural engineering, where you build trusses that must support loads.
Soft bodies — by connecting particles in closed shapes with internal pressure, you get deformable objects that squish and bounce.