⛓️ 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

Kinetic E
Potential E
End speed
Sag at mid
PBD:
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.

About Chain & Rope — Position-Based Dynamics Simulation

This simulation models a flexible chain or rope as a series of point masses connected by inextensible distance constraints, solved each frame using position-based dynamics (PBD). Gravity pulls each free node downward via Verlet integration, and an iterative constraint solver projects nodes back to the correct link length, reproducing realistic sagging, wave propagation, and energy-focusing effects. Users can observe how the hanging chain settles into the classic catenary curve, how standing waves travel along the rope, and how the free tip can reach speeds far exceeding the driving motion.

Chains and ropes governed by these same physical laws appear everywhere from suspension bridges and mooring cables to the crack of a bullwhip breaking the sound barrier; PBD itself is the algorithm behind rope and cloth in major game engines such as Unreal and Unity.

Frequently Asked Questions

What is position-based dynamics (PBD) and why is it used for ropes?

PBD is a simulation method that enforces geometric constraints directly on particle positions rather than through forces. Each time step, nodes are first moved freely by gravity using Verlet integration, then the solver iterates over every link and nudges neighbouring nodes apart or together until all link lengths equal the target value. The approach is fast, stable even with large time steps, and naturally prevents the rope from stretching, which makes it the preferred technique for interactive rope and cloth in games and film VFX.

How do I interact with the simulation?

Drag any node directly on the canvas to pull that point of the chain; release to let it swing freely. Use "Pin left" to anchor the left endpoint to the ceiling, "Both" to pin both ends, and "Free both" to drop the whole chain into free fall. The "Pulse" button kicks the midpoint upward to launch a transverse wave, and "Reset" restores the default configuration. Adjust the Links N, Gravity, Damping, and Stiffness sliders to explore how each parameter changes the motion in real time.

What is the catenary shape and when does it appear?

When both endpoints are pinned at the same height and the chain hangs freely under gravity, it settles into a catenary curve described by y = a * cosh(x/a), where a = T0 / (rho * g) depends on the horizontal tension T0, the linear mass density rho, and gravitational acceleration g. The simulation draws a faint blue dashed catenary reference line whenever both ends are pinned at similar heights, so you can verify that the simulated chain matches the mathematical ideal as the stiffness iteration count increases.

How does the cracking-whip (end-velocity amplification) effect work?

When a wave travels down a hanging rope toward the free end, it encounters progressively fewer links carrying the energy. Because energy is conserved and the effective mass in motion decreases, the velocity of the tip must increase to compensate — the same principle as a converging wave in a tapered medium. For an ideal uniform rope the free-end speed can reach approximately sqrt(3) times the speed of the initial disturbance, which in a real bullwhip is enough to exceed the speed of sound (~343 m/s) and produce a sharp sonic crack. In the simulation you can watch the "End speed" stat spike when you trigger a Pulse with one end free.

What are real-world applications of flexible-body rope physics?

Cable-stayed and suspension bridges rely on catenary and parabolic cable shapes to distribute load efficiently; the Forth Bridge and Golden Gate Bridge are well-known examples. Underwater mooring lines for oil platforms must withstand dynamic wave loading modelled with chain equations. Elevator cables, crane ropes, and zip-lines all require engineers to predict sag, tension, and resonant frequencies. In robotics, cable-driven manipulators use rope-physics models to control position through tension. Even the motion of DNA strands in solution is sometimes approximated using bead-and-spring chain models closely related to PBD.

Does a heavier chain hang differently from a lighter one?

The shape of a perfectly flexible, uniformly dense chain hanging under its own weight is always a catenary regardless of its linear mass density — the density cancels out of the shape equation. What changes with density is the tension required to maintain that shape: a heavier chain needs proportionally greater tension at the anchor points. In the simulation the Gravity slider effectively scales the weight per node, so increasing gravity steepens the sag (because the horizontal tension provided by the constraint solver is finite), illustrating this tension-shape relationship clearly.

Who first described the catenary curve mathematically?

Galileo incorrectly believed the hanging chain formed a parabola (1638). The correct catenary equation was derived independently in 1691 by Gottfried Wilhelm Leibniz, Christiaan Huygens, and Johann Bernoulli, all responding to a challenge posed by Jakob Bernoulli. The name "catenary" (from the Latin catena, chain) was introduced by Christiaan Huygens in a letter that year. Johann Bernoulli's proof used the newly invented calculus, making it one of the first major physical problems solved with that tool. James Clerk Maxwell later used the catenary as an example in his 1873 textbook on mechanics.

What other simulations are closely related to chain and rope physics?

Cloth simulation is the two-dimensional extension of rope PBD: a grid of nodes connected by stretch, shear, and bend constraints. Soft-body physics (jelly, flesh) uses volumetric constraints on the same point-mass framework. Fluid SPH (smoothed-particle hydrodynamics) replaces distance constraints with pressure forces but shares the particle-based philosophy. Hair and fur in film rendering use similar chain models with added torsion and bending stiffness. The mysimulator.uk cloth simulation uses the identical PBD solver extended to a 2D mesh, so the techniques transfer directly.

How is rope physics used in modern game engines and film VFX?

Unreal Engine's Chaos physics system and Unity's DOTS physics both implement PBD for rope, cable, and cloth components, enabling real-time interaction at interactive frame rates. NVIDIA PhysX, used in many commercial games, also uses a PBD-like extended position-based dynamics (XPBD) solver that provides constraint-independent stiffness control. In film VFX, Houdini Vellum and Autodesk Maya nCloth use PBD-derived solvers for ropes, hair, and fabric because the method remains stable even when constraint counts are very high, unlike force-based ODE integrators that can explode numerically at large time steps.

What is extended position-based dynamics (XPBD) and how does it improve on standard PBD?

Standard PBD has a known limitation: the apparent stiffness of a constraint depends on the number of solver iterations and the time step size, making it hard to tune physical parameters independently of numerical settings. Extended PBD (XPBD), introduced by Miles Macklin and Matthias Muller in 2016, adds a compliance parameter to each constraint so that stiffness is decoupled from iteration count and dt. This allows artists and engineers to specify physically meaningful stiffness values (in N/m) directly, and it also enables simulation of elastic ropes that stretch by a controlled amount rather than being perfectly inextensible. Current research directions include GPU-parallel XPBD for millions of rope segments, coupling rope solvers with fluid and rigid-body solvers, and data-driven compliance parameters learned from real material tests.