Ragdoll Sandbox
Two ragdolls, a rope, a tearable curtain, and the physics engine from Bamboo Kungfu with all its knobs exposed. Grab anything. Fling everything.
What is the Ragdoll Sandbox?
This is a physics toy with nothing between you and the engine. The scene holds two ragdolls, a hanging rope and a cloth curtain, all simulated by a verlet engine — point masses, distance constraints, and an iterative solver running sixty times a second. It is the shared core of the engine we wrote for Bamboo Kungfu, the site's bamboo-puppet duel game, now exposed with sliders instead of hidden behind gameplay: you set the gravity, you supply the wind, and everything on screen simply obeys.
There is no score and no failure state, which is rather the point — sandboxes are how physics engines are meant to be understood. Grab a ragdoll by the ankle and it dangles believably; yank the curtain and threads snap one by one; kill the gravity mid-fling and the doll sails in a straight line, exactly as Newton insists it should. The only number the sandbox keeps is your biggest fling, because everyone throws the ragdoll as hard as they can eventually, and that number deserves a leaderboard of one.
How to Play
The Physics in Plain Words
Verlet integration stores where each point is and where it was one frame ago; the difference is its velocity, and next frame it keeps going that way plus gravity. That is the whole integrator — no velocity variables, no forces accumulating, which is why it is so stable when things get tangled.
Distance constraints are the skeleton. A stick between two points insists they stay a fixed distance apart; when a frame moves them too far or too close, the solver nudges both ends back toward the correct length. A ragdoll is eleven points and a dozen such sticks; the cloth is a grid of them; the rope is a chain.
Iterative relaxation is the trick that makes it believable. Satisfying one constraint disturbs its neighbours, so the solver sweeps the whole list nine times per frame, and each sweep leaves the system a little more consistent. Nine passes is enough for limbs that feel connected; one pass would give you rubber; ninety would waste battery for no visible gain. Tearing is the same machinery in reverse — a cloth thread whose stretch exceeds about twice its rest length is simply deleted.
Things to Try
Four experiments the sliders make possible:
Newton's first law, the fun way
Swing a ragdoll in a circle, slide gravity to 0% and let go. It travels in a dead-straight line until it hits a wall — inertia with no force to bend it. Restore gravity mid-flight and watch the parabola resume.
Tear the curtain scientifically
A slow pull stretches the cloth and it holds; a fast yank concentrates the stretch in a few threads and they snap. That difference — load spread over time versus load spiked — is the same reason a slowly loaded rope survives what a jerk destroys.
Make a hurricane flag
Wind to full, gravity to 30%, and the curtain becomes a flag in a gale, rippling with waves that travel along it. Nobody programmed flag-waving; it emerges from a grid of distance constraints and a sideways push. This is how cheap cloth in games has worked for twenty years.
Chase a record fling
The meter reads release speed, so the trick is a sling: whirl the ragdoll in a fast circle and release at the bottom of the arc. Slow-mo is disqualified from records — the meter knows — so set gravity low, spin hard, and let physics do the bragging.
Honest Limits
Bodies here do not collide with each other — ragdolls pass through ragdolls, and cloth through rope — because point-versus-stick collision is the expensive half of a physics engine and this sandbox is about the cheap, magical half. Points do collide with the floor and walls. There is no friction beyond a damped floor bounce, no air resistance (wind is a push, not a fluid), and the engine is shared with our other physics pages via one small script — /engine/verlet.js, about five kilobytes — rather than a physics library a hundred times that size. If you want to see the same engine with gameplay wrapped around it, that is Bamboo Kungfu.
FAQ
Is the Ragdoll Sandbox free?
Yes — the sandbox is completely free and runs instantly in your browser. There is no download, no sign-up, and nothing to install.
What physics engine does it use?
A verlet engine written from scratch for this site: every body is a set of point masses connected by distance constraints, integrated with position verlet and relaxed by an iterative solver. It is the same technique — and the same shared engine core — behind vygam's Bamboo Kungfu duel game. No physics library is loaded.
How do I tear the cloth?
Grab a point on the curtain and pull hard. Each thread is a constraint that snaps when stretched past roughly twice its rest length, so a slow drag reshapes the cloth while a fast yank rips a hole through it. Reset brings the curtain back.
Why do the ragdolls flop so convincingly?
Because nothing is animated. Each ragdoll is just eleven points and a dozen constraints — the flopping is the solver settling those constraints under gravity, sixty times a second. Convincing limpness is what verlet physics does naturally, which is exactly why games use it for ragdolls.
What does the fling meter measure?
The speed of whatever you release, in pixels per second, at the moment you let go. Your biggest fling is saved in your browser's local storage on this device — slow-motion flings are disqualified, for obvious reasons.