Cinematic spells
Spells that act on real bodies: they pin, tear and slice ragdolls instead of playing a canned death. Chains, lightning, roots, crystals and falling planets, five 6 to 12 second set pieces for three.js on Patch's mannequin.
It's Chiro Visuals' October Elemental Sandbox (MIT) with its code unedited, its five spells whose models can be shipped, and Patch's mannequin (CC0) as the caster and the targets. There's no physics engine: the ragdoll is the sandbox's own position-based solver, about 1,200 lines. In the live demo, choose a spell, move the pointer over a body and click. Right click or Esc puts the spell away until the next click, the wheel zooms and the right button orbits.
Use it in a game
Copy app.js, mannequin.js, sandbox/, public/hdri and public/models into your game, with the @spells alias from vite.config and lil-gui.
app.js builds the scene and is the reference for wiring it, about 400 lines with the sandbox's own core/App.js as its model:
- Make the shared pieces once: the
ParticleEngine, aLightPool,CameraShake,ScreenFlash,DecalSystemandBurstSystem(sandbox/effects,sandbox/particles). - Make the
AbilityManagerwith them and with your bodies (dummies), load the spells' models into itsmodels, and cast withabilities.cast(origin, direction, distance, id). - Call
abilities.update(dt), then your bodies'update(dt)andapplyHits(abilities.active), thenabilities.lateUpdate(dt)every frame: a chain wound round a limb has to draw off the pose the solver just produced. - Tune each spell in
sandbox/config/settings.js.
Your own bodies. A body is any humanoid skinned mesh with the usual bone names (Hips, Spine, Spine1, Spine2, Neck, Head, HeadTop_End, LeftShoulder, LeftArm, LeftForeArm, LeftHand, LeftUpLeg, LeftLeg, LeftFoot, LeftToeBase, LeftToe_End, and the same on the right). mannequin.js shows the smallest way in: MannequinField hands DummyField a glTF instead of its FBX, and MannequinController replaces only CharacterController#load. The tear splits a body by its skin weights, so a rigid figure comes apart at its joints and a soft one along its skin.
Warm it up before the first cast. Each spell builds its meshes and materials the first time it's cast, and three compiles a shader program the first time it draws one. SpellsApp#warmUp in app.js does all of it while the demo loads, out of sight: it fills every spell's pool, compiles every material in the background keyed for the post stack's render target (where the scene is drawn), draws one frame with everything forced visible, then casts every spell on real bodies and plays it out. The sandbox's own warm-up waits on each shader link in turn, about 11 s; this takes about 3 s for the same spells.
Controls
The block page talks to the demo over the patch-block message channel (lib/patch-block.js). Casting happens in the frame.
For people (the block page shows these):
| id | Control | Type | Range | What it does |
|---|---|---|---|---|
spell | Spell | choice | 5 options, each with a picture; default Chains of Penance | Which spell a click casts. |
speed | Speed | number | 0.1 to 2 ×, default 1 | How fast everything plays: below 1 is slow motion. |
glow | Glow | number | 0 to 2, default 1 | How brightly the spells glow. |
Trigger: Clear (clear): Takes away every cast and what it left behind, and stands the bodies back up.
For agents (in recipe.json with its default): shake (toggle, default on): whether big impacts shake the camera.
Each option's picture is thumbs/spells/<id>.webp, a 112 x 112 still of that spell, captured from the built demo.
| Spell | How it's aimed | What it does |
|---|---|---|
| Chains of Penance | Takes the body you point at | Portals of gold open round it, barbed chains haul it up and pull until the limbs come off, and each goes back through its own portal. It leaves a red stain on the floor. |
| Stormheart Gyroscope | A circle of 6 m | A brass gyroscope condenses over the circle and fires forking lightning from body to body, then overloads into everything left. |
| Wildroot Reliquary | Takes the body you point at | Roots arch over it, hang it in a ring of runestones and drag it into the earth. |
| Amethyst Verdict | Takes the body you point at | Amethyst points rise round it, turn on it and crush it. |
| Astral Tome | A circle of 6 m | A tome flies in and opens an orrery over the circle, and its planets fall on everyone inside. |
Build it
npm install
npm run build # writes recipe.json, then dist/ (~8 MB), with thumbs/ copied in
dist/ is the live demo exactly as released, with index.html at the top and nothing loaded from other hosts. The build halves the HDRI to 1024 x 512 (hdr-half.mjs), since it only lights the scene.
| Path | What |
|---|---|
demo.js, index.html | The demo page and its label (Patch, MIT) |
app.js | The scene: the sandbox's wiring without its hall, HUD, editor and webcam, and the warm-up (Patch, MIT) |
mannequin.js | The bodies: the sandbox's caster and targets with their loading replaced (Patch, MIT) |
mannequin/ | The mannequin's Blender build, with PATCH_TARGET=<file> for the targets' skinned copy (Patch, CC0) |
recipe.json, make-recipe.mjs | The release recipe (mode browser with its block section) |
thumbs/spells/ | The spell pictures, stills of this demo |
sandbox/ | The October Elemental Sandbox's src, unedited, from commit e856fac, without archive/ and phone/ |
public/ | The HDRI and the models (in Git LFS) |
fonts/ | Red Hat Mono 500, latin, for the label |
lib/patch-block.js | Patch's block demo helper |
build.mjs, vite.config.mjs, hdr-half.mjs | The build |
What isn't here
The sandbox has nine spells; these are the five whose every part can be shipped. Left out on purpose, with their code still in sandbox/ but never loaded:
- Dragonfire Circle: its dragon is CC-BY-NC on Sketchfab, non-commercial.
- Abyssal Maw and Astral Fang: their shark and wolf come from Sketchfab with no author or licence stated.
- Starbreaker Lance: it works, but it's about the same as the Nova Beam in
patch/abilities. - The sandbox's character and practice dummy (Mixamo exports), its hall, its stone scans (no source stated), its webcam casting and the author's contact photo.
Credits and licences
- Elemental Sandbox by Chiro Visuals (mohamedachrefelouafi), MIT, © 2026 mohamedachrefelouafi (repo,
sandbox/LICENSE): the spells, the ragdoll, the effects and the GLSL. Credit line: "Elemental Sandbox by Chiro Visuals (MIT)". - The tome, the reliquary and the amethyst points (
public/models/arcane_tome.glb,wildroot_reliquary.glb,amethyst_stones.glb): built in Blender by Chiro Visuals, as that repo ships them, MIT. - The gyroscope (
public/models/magical_gyroscope.glb): "Magical gyroscope" by reddification, CC-BY 4.0: credit it if you ship it. - The mannequin (
public/models/mannequin.glb,mannequin-target.glb,mannequin/): Patch's scale figure, rigged by Patch, CC0. - Its clips: retargeted from Quaternius' Universal Animation Library 1 and 2, CC0.
- HDRI (
public/hdri/spruit_sunrise.hdr): Spruit Sunrise, Poly Haven, CC0. - Red Hat Mono: The Red Hat Project Authors, SIL Open Font License 1.1 (
fonts/OFL-red-hat-mono.txt). - three.js and lil-gui: MIT.
- The demo page,
app.jsandmannequin.js: Patch, MIT. The pictures inthumbs/: stills of this demo, Patch, CC0.
Code: MIT (LICENSE). Art: CC-BY 4.0 as a whole, because the gyroscope is; everything else in public/ is CC0 or MIT, as above.