Skip to content

API Class Animator

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

Class: Animator

Defined in: src/plugins/animation/runtime/components/Animator.ts:40

Base class for everything attached to a node: built-in engine components and user GameBehaviors (ADR 0007, 0009). Instances are created by the engine (node.addBehavior(Type) or scene loading), never with new by game code.

Extends

Constructors

Constructor

new Animator(): Animator;

Returns

Animator

Inherited from

Component.constructor

Properties

cullingMode

cullingMode: AnimatorCullingMode = "always";

Defined in: src/plugins/animation/runtime/components/Animator.ts:72

What it does while no camera sees it: keep animating, freeze the pose while playheads advance, or keep only root motion.


defaultClip

defaultClip: string = "";

Defined in: src/plugins/animation/runtime/components/Animator.ts:51

A clip the implicit graph plays on start when there is no graph (Unity's legacy Animation, Godot's autoplay). Empty: nothing plays until code calls play.


graph

graph: string = "";

Defined in: src/plugins/animation/runtime/components/Animator.ts:45

The animation graph (*.animgraph.json). Empty: an implicit single-layer graph that play and crossfade drive.


ikTargetNodes

ikTargetNodes: (GameObject | null)[] = [];

Defined in: src/plugins/animation/runtime/components/Animator.ts:106

The node each of ikTargets follows (its world transform, every frame).


ikTargets

ikTargets: string[] = [];

Defined in: src/plugins/animation/runtime/components/Animator.ts:103

IK goals of the graph's rig stack bound to nodes, by goal name; ikTargetNodes[i] is goal ikTargets[i]'s target.


linkedGraphNodes

linkedGraphNodes: string[] = [];

Defined in: src/plugins/animation/runtime/components/Animator.ts:54

Linked-graph nodes to run another graph in, by node name; linkedGraphs[i] replaces node linkedGraphNodes[i]'s default.


linkedGraphs

linkedGraphs: string[] = [];

Defined in: src/plugins/animation/runtime/components/Animator.ts:57

The graph each of linkedGraphNodes runs (*.animgraph.json); an empty entry keeps the node's default.


lodEvery2

lodEvery2: number = 20;

Defined in: src/plugins/animation/runtime/components/Animator.ts:88

Past this distance (metres), or below this screen-height share, the pose updates every 2nd frame, interpolated between.


lodEvery4

lodEvery4: number = 40;

Defined in: src/plugins/animation/runtime/components/Animator.ts:91

Past this distance, or below this screen-height share, the pose updates every 4th frame.


lodMetric

lodMetric: AnimatorLodMetric = "off";

Defined in: src/plugins/animation/runtime/components/Animator.ts:85

What update-rate LOD measures: nothing (every frame), distance to the camera, the share of the screen's height, or the enclosing LODGroup's level for the main camera (ADR 0542 §6: level 0 updates every frame, level 1 every 2nd, level 2 and below every 4th; a group culled by LOD counts as not visible for cullingMode).


lodSearchMultiplier

lodSearchMultiplier: number = 2;

Defined in: src/plugins/animation/runtime/components/Animator.ts:97

At each slower LOD rate, motion-matching searches run this many times less often.


parameters

parameters: Record<string, number | boolean | number[]> = {};

Defined in: src/plugins/animation/runtime/components/Animator.ts:63

Starting values of graph parameters, by name, overriding the graph asset's defaults: numbers, booleans, and number arrays for vec2, vec3 and quat (node parameters start empty). Edited in the Animator's Inspector section.


rigCullDistance

rigCullDistance: number = 0;

Defined in: src/plugins/animation/runtime/components/Animator.ts:94

Past this distance (metres) the rig stack and spring bones switch off; 0 keeps them on.


rootMotion

rootMotion: AnimatorRootMotion = "none";

Defined in: src/plugins/animation/runtime/components/Animator.ts:75

Where root motion goes. characterController and rigidBody need the physics plugin; every mode fills the RootMotion buffer.


updateMode

updateMode: AnimatorUpdateMode = "normal";

Defined in: src/plugins/animation/runtime/components/Animator.ts:69

How its time advances: the World's scaled time, unscaled time, or fixed steps before physics (physics-driven and predicted characters).

Accessors

enabled

Get Signature

get enabled(): boolean;

Defined in: src/engine/core/Component.ts:63

Returns

boolean

Set Signature

set enabled(value): void;

Defined in: src/engine/core/Component.ts:67

Parameters
value

boolean

Returns

void

Inherited from

Component.enabled


gameObject

Get Signature

get gameObject(): GameObject;

Defined in: src/engine/core/Component.ts:43

Unity-style alias for node.

Returns

GameObject

Inherited from

Component.gameObject


isActiveAndEnabled

Get Signature

get isActiveAndEnabled(): boolean;

Defined in: src/engine/core/Component.ts:74

True when enabled, the node is active in the hierarchy, and the node is in a loaded world.

Returns

boolean

Inherited from

Component.isActiveAndEnabled


node

Get Signature

get node(): GameObject;

Defined in: src/engine/core/Component.ts:38

The node this component is on.

Returns

GameObject

Inherited from

Component.node


onFinished

Get Signature

get onFinished(): Promise<AnimationPlayResult>;

Defined in: src/plugins/animation/runtime/components/Animator.ts:213

The latest play's promise: it resolves when that play ends, by finishing, interruption or stop.

Returns

Promise<AnimationPlayResult>


owner

Get Signature

get owner(): GameObject;

Defined in: src/engine/core/Component.ts:51

The node this component acts for: the node itself when attached directly, or the parent node when this component lives on a component node (ADR 0009).

Returns

GameObject

Inherited from

Component.owner


time

Get Signature

get time(): Readonly<TimeState>;

Defined in: src/engine/core/Component.ts:99

This component's World's clock (ADR 0032): the same values as Time, but safe to read outside the World's frame too (after an await, say).

Returns

Readonly<TimeState>

Inherited from

Component.time


transform

Get Signature

get transform(): Transform;

Defined in: src/engine/core/Component.ts:57

The Transform of the node this component is on, if it has one.

Returns

Transform

Inherited from

Component.transform


world

Get Signature

get world(): WorldHandle;

Defined in: src/engine/core/Component.ts:88

A handle on this component's World (ADR 0132): the same one Engine.findWorld returns. Load a scene into it, pause, connect or destroy it: this.world.loadScene("scenes/level2.scene.json"). Throws for a World no Engine owns.

Returns

WorldHandle

Inherited from

Component.world

Methods

bone()

bone(name): AnimatorBone;

Defined in: src/plugins/animation/runtime/components/Animator.ts:208

A bone of the skeleton, to read this frame's pose and override it from lateUpdate(): anim.bone("Head").localRotation = q.

Parameters

name

string

Returns

AnimatorBone


compute()

compute(name, fn): void;

Defined in: src/plugins/animation/runtime/components/Animator.ts:193

Fill a parameter from fn once per frame, before evaluation (computed parameters, ADR 0372): transitions read it like any other parameter, the debugger shows it and takes record it. Null stops it.

Parameters

name

string

fn

| (() => AnimatorParameterValue) | null

Returns

void


crossfade()

crossfade(
   clip, 
   duration, 
   options?
): Promise<AnimationPlayResult>;

Defined in: src/plugins/animation/runtime/components/Animator.ts:165

Fade from what is playing to clip over duration seconds (play with a fade, plus an avatar mask).

Parameters

clip

string

duration

number

options?

AnimatorCrossfadeOptions = {}

Returns

Promise<AnimationPlayResult>


ik()

ik(name): AnimatorIKTarget;

Defined in: src/plugins/animation/runtime/components/Animator.ts:198

An IK goal of the graph's rig stack, by name, to aim from code: anim.ik("LeftHand").target(grip, { weight: 1 }).

Parameters

name

string

Returns

AnimatorIKTarget


instantiate()

instantiate(prefabPath, options?): GameObject;

Defined in: src/engine/core/Component.ts:109

Instantiate a prefab in this component's World (ADR 0034), like GameObject.instantiate. Use it in code that may run after an await: by then the frame is over and the current World is the Engine's default one, which may not be this component's. A parent from another World throws.

Parameters

prefabPath

string

options?

InstantiateOptions = {}

Returns

GameObject

Inherited from

Component.instantiate


jump()

jump(state, options?): void;

Defined in: src/plugins/animation/runtime/components/Animator.ts:150

Cut straight to state, with no path and no blend (inertialized).

Parameters

state

string

options?

AnimatorJumpOptions = {}

Returns

void


layerWeight()

layerWeight(layer, weight): void;

Defined in: src/plugins/animation/runtime/components/Animator.ts:180

Set a layer's weight, 0–1.

Parameters

layer

AnimatorLayer

weight

number

Returns

void


link()

link(node, linked): void;

Defined in: src/plugins/animation/runtime/components/Animator.ts:175

Run linked (*.animgraph.json) in the linked-graph node node (weapon layers); null puts back the node's default.

Parameters

node

string

linked

string | null

Returns

void


play()

play(clip, options?): Promise<AnimationPlayResult>;

Defined in: src/plugins/animation/runtime/components/Animator.ts:160

Play a clip: in a graph slot as a one-shot over the graph ({ slot: "UpperBody" }), or, on an Animator without a graph, on a layer of the implicit graph. clip is a clip asset (asset:anims/slash.anim.json, asset:hero.glb#Anim/Run) or a clip named in the graph. The promise resolves when the play ends, with finished, interrupted (another play took over) or stopped.

Parameters

clip

string

options?

AnimatorPlayOptions = {}

Returns

Promise<AnimationPlayResult>


request()

request(name, options?): void;

Defined in: src/plugins/animation/runtime/components/Animator.ts:136

Ask for a transition that reads name (no triggers, ADR 0372): the request stays open for within seconds (default 0.25), is consumed by the first transition that reads it, and otherwise expires, so it never fires late.

Parameters

name

string

options?

AnimatorRequestOptions = {}

Returns

void


set()

set(name, value): void;

Defined in: src/plugins/animation/runtime/components/Animator.ts:128

Set a graph parameter. The value must match the parameter's kind (float, int, bool, vec2, vec3, quat or node).

Parameters

name

string

value

AnimatorParameterValue

Returns

void


state()

state(layer?): AnimatorStateInfo;

Defined in: src/plugins/animation/runtime/components/Animator.ts:185

The active state of a layer (default 0), as of the last evaluation.

Parameters

layer?

AnimatorLayer = 0

Returns

AnimatorStateInfo


stop()

stop(options?): void;

Defined in: src/plugins/animation/runtime/components/Animator.ts:170

Stop plays: on one layer, in one slot, or (with neither) all of them; their promises resolve with stopped.

Parameters

options?

AnimatorStopOptions = {}

Returns

void


travel()

travel(state, options?): Promise<AnimatorTravelResult>;

Defined in: src/plugins/animation/runtime/components/Animator.ts:145

Go to state by the shortest path through the layer's state machine (Godot's travel), using each hop's timing and blend. The promise resolves when the machine gets there (arrived), when no path leads there (unreachable, with a warning), or when another travel or jump comes first (interrupted).

Parameters

state

string

options?

AnimatorTravelOptions = {}

Returns

Promise<AnimatorTravelResult>


warp()

warp(window, target): void;

Defined in: src/plugins/animation/runtime/components/Animator.ts:203

Where the motion-warp window window (a cue marker range of the playing clip) should land; null clears it.

Parameters

window

string

target

AnimatorWarpTarget | null

Returns

void

Clone this wiki locally