Verlet integration · Distance constraints · Drag & interact · Orbit the camera
Drag any body part to throw the ragdoll.
A 2D ragdoll simulation using Verlet integration and distance constraints. Watch a jointed character fall, bounce off platforms, and respond to dragging — all without explicit velocity storage.
Verlet integration stores position and previous-position instead of velocity. An iterative constraint solver enforces fixed-length bones and angular limits at each joint. The result is stable, realistic ragdoll motion with minimal code.
Click and drag any body part to toss the ragdoll around. Watch it interact with platforms. Observe how distance constraints keep limbs at fixed lengths while allowing natural joint articulation.
Verlet-based ragdoll physics was popularised by Thomas Jakobsen in his 2001 GDC talk. The technique is still used in modern games — Hitman, Gang Beasts and Happy Wheels all use Verlet-based ragdoll systems.
This simulation models a 2D jointed character as 16 point masses linked by fixed-length "sticks". It uses Verlet integration, where each point's velocity is implied by the difference between its current and previous positions rather than stored explicitly: x ← x + (x − x_prev) × damping + gravity. After each integration step an iterative solver repeatedly enforces every distance constraint, producing stable, lifelike limb motion from very little code.
The Gravity slider scales the downward acceleration applied each substep, Damping bleeds off velocity for stability, Constraint iters sets how many times the solver passes over every stick per frame (more passes mean stiffer bones), and Bounciness controls how much energy survives a wall or platform impact. Drag any joint to throw the figure, or hit Drop to spawn it mid-air. Verlet ragdolls are a staple of real-time game physics for characters, cloth and rope.
What is ragdoll physics?
Ragdoll physics is a technique for animating a character body as a system of connected rigid segments driven by a physics solver rather than pre-recorded animation. Here the body is 16 joints (head, neck, chest, hip, two arms and two legs) tied together by distance constraints, so it collapses and reacts naturally to forces and collisions.
What is Verlet integration and why is it used here?
Verlet integration advances a point using its current and previous positions instead of an explicit velocity vector. The implied velocity is simply (current − previous). This makes it numerically stable, energy-friendly and very convenient for constraint solving, because you can move points directly to satisfy a constraint and the next step automatically accounts for the change in implied velocity.
How do the distance constraints keep the body together?
Each "stick" stores a rest length measured when the ragdoll is built. On every solver pass it measures the current distance between its two endpoints and nudges them along the connecting line so that distance returns to the rest length, splitting the correction equally between unpinned points. Repeating this for all sticks many times per frame keeps the bones rigid.
Gravity scales the per-substep downward pull (the label shows 0–30, internally multiplied by 0.04). Damping (0.90–1.00) multiplies the implied velocity each step, so lower values calm the figure faster. Constraint iters (2–20) sets how many solver passes run per frame, raising bone stiffness. Bounciness (0–0.9) is the fraction of velocity reflected on hitting a wall or platform.
A single constraint pass only partially corrects each bone, and correcting one stick can disturb a neighbouring one. Running more iterations lets the solver converge closer to a configuration where every distance constraint is satisfied at once. With few iterations the body looks rubbery and stretchy; with many it behaves like rigid bones. The trade-off is more computation per frame.
Each point is checked against the canvas edges and against rectangular platforms after integration. If a point penetrates a surface it is pushed back to the boundary, and its previous position is adjusted so the implied velocity reverses and is scaled by the Bounciness value. This simple position-based response gives plausible bouncing without a full collision-impulse system.
The loop runs three substeps per displayed frame. Splitting each frame into smaller integration steps reduces the distance points travel between constraint solves, which improves stability and stops fast-moving limbs from passing through walls. The gravity applied per substep is divided by the substep count so the overall acceleration stays consistent regardless of substepping.
Head velocity reports the magnitude of the head joint's implied velocity in pixels per frame, so you can see how energetic the motion is. Constraint error sums the absolute length deviation across every stick, indicating how far the solver is from a perfect solution. Solver iters shows the iterations multiplied by the substeps, the total constraint passes applied each frame.
It is a qualitative, position-based approximation rather than a rigorous rigid-body simulation. It uses arbitrary pixel units, ignores true mass, rotational inertia and friction, and resolves collisions by direct repositioning. The behaviour is convincingly lifelike and great for learning, but it would not be used for engineering analysis where forces, torques and material properties must be exact.
Verlet-based ragdolls underpin real-time character physics, cloth and rope in many games because they are cheap and stable. The position-based approach popularised by Thomas Jakobsen at GDC 2001 led directly to modern Position Based Dynamics, which now drives soft bodies, fluids and clothing in game engines and visual-effects tools.