Builtin Library
README.md
animGraph Module
Public Luau surface over the __animGraph Internal FFI namespace —
the per-entity engine animation graph.
Purpose
Wrap the raw __animGraph.* FFI namespace in a typed Luau table
that gets auto-injected as _G.animGraph via the prelude. The graph
lives on the entity — methods auto-resolve from the component's
script context, or accept an explicit entityId as the first
argument.
Not to be confused with the higher-level Luau
systems/anim/AnimGraph.module library — that's a separate,
composable graph implementation; this module is the raw FFI surface
for the engine's per-entity graph.
Usage
-- Create on the current entity, route onto a child skeleton
animGraph.create({ skeleton = skelEid })
local _, _, idle = animGraph.addClip(asset.ref("animations.idle", "animation"), { loop = true })
local _, _, walk = animGraph.addClip(asset.ref("animations.walk", "animation"), { loop = true })
local _, _, run = animGraph.addClip(asset.ref("animations.run", "animation"), { loop = true })
local _, _, blend = animGraph.addBlendSpace2D({
{ node = idle, x = 0, y = 0 },
{ node = walk, x = 1, y = 0 },
{ node = run, x = 2, y = 0 },
})
animGraph.setOutput(blend)
animGraph.play()
-- Each frame
animGraph.setBlendSpaceParams(blend, speed, 0)
-- Smooth swap
animGraph.crossfade(asset.ref("animations.idle", "animation"), 0.3, { loop = true })
Exports
- Lifecycle:
create,destroy. - Nodes:
addClip,addMixer,addBlendSpace2D,setBlendSpaceParams,setOutput,setWeight,crossfade,removeNode. - Transport:
play,stop. - Introspection:
state.