This skill teaches a coding agent to bring .gltf and .glb models into a three.js r187 project and make them move. It starts by inspecting the file for compression extensions and clips, then loads it with GLTFLoader, frames it by its bounding box, and drives clips with one AnimationMixer per animated root.
It covers the failures that eat an afternoon: a model that is invisible or a hundred times too small, decoder files that return 404, animations that never advance, and clones that share one skeleton. A short runtime probe checks mesh count and mixer progress in a running page.
What You Get
- Six code patterns: load and frame a model, play a clip, cross-fade between clips, set up Draco, KTX2 and Meshopt, find a named part, and shrink a model while keeping named nodes
- A runtime probe expression that reports mesh count and whether the mixer time advanced
- A gotcha list for invisible models, undefined results outside callbacks, 404 decoder files, shared skeletons and parts that vanish after optimizing
- A reference on LoadingManager progress bars, spawning many animated enemies with SkeletonUtils.clone, AnimationAction looping and a Blender export checklist
Common Use Cases
- Importing a character GLB and playing its idle and run clips
- Fixing a model that loads but does not appear on screen
- Adding Draco, Meshopt or KTX2 compression to cut download size
- Spawning ten animated enemies that each move on their own
What Makes It Unique
The skill pins its patterns to one three.js release and lists what changed around it: Timer replacing Clock, decoder folders found without a path since r185, and the deprecated detectSupportAsync. It also warns that gltf-transform optimize flattens and joins named nodes by default, which silently removes the parts game code looks up, and it gives the flags that keep them.
Under The Hood
The agent loads the SKILL.md and reads the loaders and animation reference only when it needs detail. It edits your game source, runs the project build or type check, and runs npx commands that download and execute the gltf-transform command line tool to inspect, optimize and validate model files; optimize writes a new model file. For the runtime check it exposes objects on window and may install Playwright and a Chromium browser, then evaluates an expression in your local page. It does not call other services, though the example import map points at a public CDN.