⛓️ Chain & Rope — Position-Based Dynamics
Drag the chain end-points, throw the rope into motion, pin nodes to the ceiling. The simulation uses position-based dynamics (PBD) with iterative constraint projection — the same technique used in modern game engines for cloth and rope. Observe the catenary shape under gravity, standing waves, and whip-like end velocities.
Parameters
Controls
Drag any node to interact
Stats
1. v ← v + g·dt
2. x_pred ← x + v·dt
3. Project constraints:
|x[i+1]-x[i]| = L
4. v ← (x_pred-x)/dt
5. Apply damping
Catenary: y = a·cosh(x/a)
Rope & Chain Physics
Position-based dynamics models flexible bodies as a set of point masses connected by inextensible distance constraints. At each time step, unconstrained Verlet positions are projected iteratively back onto the constraint manifold. More iterations → stiffer rope. The equilibrium shape of a hanging chain is the catenary y = a·cosh(x/a), where a = T0/(ρg) depends on horizontal tension and linear mass density. When one end is released, the wave travels down the rope and the free end achieves velocity ≈ √3 times the endpoint speed — the cracking whip effect.