Play animation clips in the 3D viewer - #242
Conversation
Rigged models (from the rigging extensions, or any GLB with clips) render frozen in bind pose today: the viewer loads the glTF but never creates an AnimationMixer, so the clips it just parsed never run. That reads as a failed rig rather than a missing feature. Create a mixer for models that carry clips, tick it from useFrame, and dispose it with the model. When a file carries more than one clip, offer a small picker so each motion can be reviewed without leaving the app. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for tackling this — animated GLBs rendering frozen in bind pose is a real papercut, and the overall shape of the change (mixer per scene, Before anything else though: this branch doesn't build. Line 189 has a JSX expression with no right-hand operand: <option key={clip.name || i} value={i}>{clip.name || }</option>Reproduced on a fresh checkout of the PR head: Because it's a parse error rather than a runtime one, esbuild bails during transform, so Worth double-checking Three other things I noticed while reading, so they can go in the same round:
One thing that is correct and worth noting: the mixer teardown is fine — |
What
The viewer creates an
AnimationMixerfor models that carry animation clips, ticks it fromuseFrame, and disposes it with the model. When a file has more than one clip, a small picker lets you switch between them.Why
useGLTFalready parsesgltf.animations, but nothing ever plays them — a rigged model renders frozen in its bind pose. From the outside that looks like the rig failed, which is a confusing first experience of any rigging extension (UniRig, SkinTokens, or a hand-made rig). Three lines of state and a mixer make the model move.Tested on Linux with GLB files carrying one clip and three clips (skinned mesh, 8-bone chain): single clips autoplay, multi-clip files default to the first and switch cleanly via the picker, and unloading a model stops and uncaches the mixer.
Notes
AnimationMixercomes from thethreealready imported, andHtmlfrom the@react-three/dreialready in use.🤖 Generated with Claude Code