Expand description
The animation state machine: what an AnimationGraph asset compiles into,
the blendspace members a state can play, and the cursor that walks it.
A CompiledGraph is read-only once built, except for the clip-duration
refresh a hot-reload applies. A GraphCursor is the live position in one:
the client’s animation system owns one per graph target, advances it each
frame, and samples the blended pose through sample_graph_pose_into.
Structs§
- Blend1D
- A 1D blendspace: members at ascending
thresholdspositions along one parameter. The parameter picks the bracketing pair and lerps their weights; outside the range the nearest end member plays alone. - Blend2D
- A 2D blendspace: members on a regular grid over two parameters, weighted
bilinearly across the four members surrounding the parameter point.
playsis row-major:plays[iy * x_values.len() + ix]sits at(x_values[ix], y_values[iy]). - Clip
Play - One playable member: a clip index in the target’s clip list plus its duration, copied at compile time for wrap / phase math (refreshed on clip hot-reload).
- Compiled
Condition - One compiled transition condition: parameter names are resolved to indices into the graph’s parameter vector at compile time, so evaluation is a direct slice read (the runtime blob interner is empty; nothing resolves names at runtime).
- Compiled
Graph - A compiled animation state machine. Built once from the
AnimationGraphasset; read-only afterwards except for clip-duration refresh on hot-reload. - Compiled
State - One compiled state: what it plays (a clip or a blendspace, at
rate) and its outgoing transitions in declaration order (first match wins). - Compiled
Transition - One compiled outgoing transition. Conditions AND together; an empty list is
always true (useful with
exit_timealone). - Graph
Cursor - The live position in a graph: current state, its clock, and any in-flight crossfade. One per graph target, owned by the client’s AnimationSystem.
- Param
Spec - A graph parameter: a named float, seeded to
default. - State
Fade - An in-flight crossfade from the previous state. The outgoing state’s clock keeps advancing during the fade so its pose stays live rather than frozen.
Enums§
- CmpOp
- Comparison operator for a transition condition, evaluated as
parameter <op> value.eq/necompare exactly and are mainly useful for flag-like parameters holding whole numbers such as 0 and 1. - State
Play - What a compiled state plays.
Functions§
- blend1d_
weights - 1D blendspace weights:
xagainst ascendingthresholds. Outside the range the nearest end gets full weight; inside, the bracketing pair lerps. At most two weights are nonzero. - blend2d_
weights - 2D blendspace weights: bilinear over the grid cell containing
(x, y), clamped to the grid edges. Row-major to matchBlend2D::plays; at most four weights are nonzero. - cursor_
root_ delta - The displacement covered between the cursor snapshots taken before and
after one
advance, in the mesh’s local space. A frame that took a transition contributes nothing (the clocks reset mid-frame; one frame of root motion at a state change is imperceptible and never wrong-direction). While a fade is in flight the outgoing state’s displacement blends in by the fade’s progress, matching the pose crossfade. - normalized_
time - A state’s normalized time in [0, 1]: the fraction of one full pass covered
by the clock. Looping states report the fraction within the current pass,
so an
exit_timegate re-opens every loop; a non-looping state saturates at one. Blendspace passes are measured against the weight-averaged member duration at the current parameters. - sample_
graph_ pose_ into - Sample the cursor’s blended pose into
scratch.locals.clip_atmaps a member’s clip index to the actual clip (the caller owns clip storage). The remaining scratch buffers hold the fade’s outgoing pose and the per-member samples, so a warm scratch samples without allocating.