Skip to content

Play animation clips in the 3D viewer - #242

Open
OmarB97 wants to merge 1 commit into
lightningpixel:mainfrom
OmarB97:feat/animated-model-playback
Open

Play animation clips in the 3D viewer#242
OmarB97 wants to merge 1 commit into
lightningpixel:mainfrom
OmarB97:feat/animated-model-playback

Conversation

@OmarB97

@OmarB97 OmarB97 commented Jul 27, 2026

Copy link
Copy Markdown

What

The viewer creates an AnimationMixer for models that carry animation clips, ticks it from useFrame, and disposes it with the model. When a file has more than one clip, a small picker lets you switch between them.

Why

useGLTF already parses gltf.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

  • No new dependencies — AnimationMixer comes from the three already imported, and Html from the @react-three/drei already in use.
  • Models without clips take an early return, so the static path is unchanged.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant