🎞️Create an Animation State Machine
An animation state machine decides which clip plays now and when to switch. You do not play clips by name from gameplay every frame. You set parameters. The graph compares those values and takes transitions. The mesh follows the active state.
This page is for a person building or debugging the graph in the Model Viewer, and for an agent that must wire the same system in a v14 project. Read how the config and graph fit together before you click through the stepper. When motion fails, open the config first — do not burn a long chat guessing in TypeScript.
Animation config, graph, and state machine
Three names for related pieces. Mixing them up is the usual failure.
Animation config
The asset that stores the whole graph
assets/.../*.animconfig.json (ENGINE.AnimationConfigResource)
Graph
What you see in the Model Viewer: states (boxes) and transitions (lines)
Edited inside that config
State machine node
The scene node that plays the config on a skeleton
ENGINE.AnimationStateMachineNode on the character; Inspector field configUrl
The .glb holds recorded clips (Idle, Run, an attack). The config chooses which clips matter, how they loop, which state plays which clip, and which lines connect those states. The node only points at the config and receives parameter writes from the pawn or your code.
If the clip is only in the .glb and never enters the config, the graph cannot play it. If two states exist but there is no transition line, a parameter change will not move you between them. If configUrl is empty or points at the wrong file, Play uses nothing useful.
What the graph is doing
A state is one mode of motion: Idle, Run, Jump, an attack. Only one state is active on a layer at a time. The config marks one state as initialState — that is where Play starts.
A clip is one recorded animation. A state either plays a single clip, or blends several clips using Number parameters as weights (for example forward / back / left / right).
A transition is a line on the graph from one state to another. It has a destination, a blendDuration in seconds, and a condition. When the condition is true, the machine leaves the current state and mixes into the next.
A parameter is a Boolean or Number stored on the config and updated at runtime. The graph only reads parameters. Gameplay code (or the default Character Pawn) writes them with setParameter. If nothing writes parameters, the character stays in initialState forever.
Typical locomotion loop:
Pawn moves → code sets
isRunning: trueand aforwardweight.The Idle → Run transition’s condition matches.
The machine blends into Run.
When movement stops, the return transition’s condition sends the machine back to Idle.
Conditions you will see:
Boolean / Number compare
Equal, not equal, greater than, less than a value you chose
clipFinished: true
The current clip reached the end — used for attacks and recoveries
What sits inside .animconfig.json
The Model Viewer edits this file. Prefer the graph UI. Knowing the parts helps you diagnose and brief the agent.
initialState
Name of the state that starts on Play
parameters
Default Booleans and Numbers (for example isRunning, forward)
states
Each named state: a clip, or a blend list, plus transitions to other states
transitions (on a state)
Lines out of that state: to, blendDuration, condition
clipOptions
Per-clip settings such as loop (LoopRepeat vs LoopOnce)
oneShotClips
Clips marked to play once over the current state (often empty when attacks are full states)
externalAnimationSources
Extra .glb files (and optional skeleton profiles) that supply more clips
A state with no transitions array (or an empty one) never leaves that state by graph rules. Death poses sometimes stay that way on purpose. Locomotion Idle ↔ Run must have lines both ways (or you will stick).
One-shot vs looping vs attack states
Clip / state set to loop (LoopRepeat)
Motion repeats until a transition leaves the state
Idle, walk, run
Clip set to play once (LoopOnce)
Plays to the end, then stops or holds
Attacks, hit reacts, death
One-shot clips list on the config
Play once over the current state without permanently replacing locomotion
Short overlays — easy to misread when diagnosing
Attack as its own state + clipFinished transition back to Idle/Run
Leave locomotion, play the attack, return when the clip ends
Preferred in many production graphs
If locomotion “doesn’t play,” check whether the Idle or Run clip is marked one-shot / LoopOnce, or whether the clip sits only in oneShotClips instead of on a looping state. Do not put the same motion in both a one-shot list and a state without testing.
When animation does not play
Open the character’s .animconfig.json in the Model Viewer (or review the graph the agent edited). Work this list before asking the AI to rewrite pawn code.
1. configUrl
Select the Animation State Machine Node. configUrl points at the .animconfig.json you mean (@project/... or @engine/...).
2. Clip exists on the model
Model Viewer lists the clip on the .glb. If the list is empty, the file is not a usable animated rig. How to import a rigged character and animation clips
3. Clip is in this config
The clip is assigned on a state (or listed via Sources / externalAnimationSources). A clip only on disk does nothing.
4. Transition lines
The states you care about are connected. Idle ↔ Run needs lines and conditions. Missing lines = parameters never change the pose.
5. One-shot / loop
Locomotion clips loop. Attacks may be one-shot or LoopOnce. A looping idle stuck as one-shot will not behave like Idle.
6. Parameters
Names in code match the graph exactly (isRunning, not running). Default humanoids also need directional weights; isRunning: true with forward/back/left/right all 0 can look idle inside Run.
7. Who writes parameters
Character Pawn templates write locomotion for you. A custom pawn must call setParameter (or transitionGraphToState for forced states).
Most “AI can’t find it” cases are rows 3, 4, or 5.
How Sandbox Studio wires it (v14)
Animation Config
The graph: clips, states, transitions, parameters
assets/.../*.animconfig.json
State machine node
Plays that graph on a skeleton
ENGINE.AnimationStateMachineNode
Runtime writes
Changes parameters (or forces a graph state)
Your pawn / node TypeScript
Create the node in code the same way default characters do:
configUrl is always a fully qualified @project/assets/... or @engine/assets/... path. After you add a class, run pnpm build and Build Project (Ctrl+B / Cmd+B). See Project code fundamentals.
Find the node at runtime:
Parameters the default humanoid graph expects
Movement templates and CharacterPawn already create an AnimationStateMachineNode and push locomotion into the graph. You do not rebuild Idle/Run for those templates unless you replace the config.
A shipping character config uses this parameter set (names must match the graph exactly):
isRunning
Boolean
Idle ↔ run
isJumping
Boolean
Jump
forward
Number
Weight of the run-forward clip
back
Number
Weight of the run-backward clip
left
Number
Weight of strafe-left
right
Number
Weight of strafe-right
Write several at once:
A Run state is often a blend, not a single clip: each directional clip is weighted by forward / back / left / right. If you only set isRunning and leave weights at 0, the character can enter Run and still look idle.
Attacks and other one-off motion
The Model Viewer can mark one-shot clips (play once over the current state). Many production graphs instead add extra states (for example an attack state) and leave oneShotClips empty. Those states return with { "clipFinished": true }.
Combat code often calls anim.transitionGraphToState('base', 'attackState') (or back to 'idle') rather than hoping a one-shot mixer interrupt. If the agent is adding melee animation, match that pattern: named states + clipFinished + transitionGraphToState, unless the config you opened actually lists one-shot clips.
Event markers on clips (for example footstep, hitStart / hitEnd at a time in seconds) fire during playback so audio and hitboxes can sync. Layers, bone masks, and skeleton retargeting exist in the same system. Import, profiles, extra clip .glb files, and attaching a held mesh: How to import a rigged character and animation clips.
What to ask the agent
MCP does not have a special animation tool. The agent edits the config and the pawn the same way it edits other assets and TypeScript. Be specific. Tell it to inspect the graph before rewriting code:
“Open
@project/assets/character/<name>.animconfig.json. Confirm the clip is in the config, Idle/Run have transition lines with conditions, and locomotion clips loop (not one-shot). Then fix only what is missing.”“Add Idle and a blended Run using
isRunning,forward,back,left,right. Point the pawn’sAnimationStateMachineNode.configUrlat that file.”“Do not play clips by calling Three.js actions from gameplay. Use
setParameterortransitionGraphToState.” What Three.js is in Studio: What Three.js means in Sandbox Studio.“Do not open
.genesys-scenefiles to bind animation. SetconfigUrlon the node.”
Use Sandbox Studio MCP so the agent can place nodes and build the project after the change.
Build the graph in the editor
Configure one-shot clips
Open the config settings and enable the clips that should play once over the current state. Use one-shot clips for temporary actions such as an attack, reaction, or other motion that should not replace the normal state permanently.
If you are following a template character, check whether attacks are already states with clipFinished instead. Do not add both a one-shot and a state for the same clip without testing.
Leave locomotion clips out of the one-shot list. Idle and Run should loop on their states.
The agent can generate and adjust state machines when you ask. Review the graph and test it in Play mode.
What You've Done
You know the animation config is the .animconfig.json graph (states, transition lines, parameters, clip loop settings), the state machine node plays it through configUrl, and motion only changes when parameters (or transitionGraphToState) change. You can check missing clips, missing lines, and one-shot mistakes before handing the problem to the AI. Imported rigs and extra clip files: How to import a rigged character and animation clips.
Last updated
Was this helpful?

