Contents

AnimationGraphComponent

A component that drives skeletal animation on an entity using a node-based animation graph.

Declaration

struct AnimationGraphComponent

Overview

Animation graphs blend and transition between multiple animations at runtime using a graph of connected nodes.

Use AnimationGraphComponent to attach a compiled AnimationGraphResource to an entity. RealityKit evaluates the graph each frame and writes the resulting pose to the entity’s SkeletalPosesComponent.

Attach a graph to an entity

entity.components.set(AnimationGraphComponent(resource: graphResource))

Inspect the active graph state

activeNodes reflects all nodes that contributed to the current pose. Use activeStateMachineNodes or activeClipNodes to work directly with a specific node type.

for node in component.activeStateMachineNodes {
    print("Current state: \(node.currentState)")
}

for node in component.activeClipNodes {
    print("Current cycle: \(node.currentCycle)")
}

Topics

Creating a component

Accessing the graph

Accessing active nodes

Accessing active tags

See Also

Animation graphs