AnimationSystem
System that updates all AnimatorComponents each frame Samples animations, computes bone hierarchies, produces skinning matrices
- Module
- Game
- Header
#include "Animation/AnimationSystem.h"- Namespace
Mowo
Evaluation is two-phase: a serial gather pass resolves every animator's components and LOD interval, then the per-animator evaluation (sampling, blending, IK, motion matching, bone palette) fans out across the job system with per-thread scratch — each job writes only its own entity's components, so results are bit-identical to the serial order. Animation events are queued during evaluation and their callbacks dispatched serially afterwards in gather order, never from worker threads.
Public functions
| Returns | Name | Description |
|---|---|---|
void | Initialize | |
void | Shutdown | |
void | Update | |
void | SetLODFocus | Update-rate LOD (EX6, UE URO analog): animators beyond a.LODNearRadius from the focus sample every a.LODNearInterval frames (a.LODFarInterval beyond a.LODFarRadius), banking the skipped dt so animation time stays continuous. |
void | ClearLODFocus | |
uint64_t | GetLODSkippedCount | |
void | NoteRendered | UE's VisibilityBasedAnimTickOption input: the scene calls this for every skinned animator it draws inside the camera frustum. |
uint64_t | GetUpdateSerial | |
uint64_t | GetOffscreenSkippedCount | |
uint64_t | GetBudgetDeferredCount | UE's AnimationBudgetAllocator: with a.BudgetMs > 0, the evaluation pass is held to that many milliseconds by deferring the lowest-priority animators (offscreen first, then by significance or focus distance) to a later frame with their dt banked. |
double | GetAverageEvalCostMs | |
void | SetAverageEvalCostMsForTest | |
void | ResolveControllerAsset | Load the animator's authored .manim controller into controller, once. |
void | ResolveControlRigAsset | Load the component's authored .mcontrolrig into rig, once, off the VFS. |
void | ResolveRetargeterAsset | Load the component's authored .mretarget into options, once, off the VFS. |
uint32_t | HydrateAssets | Every asset an animator in world will need — controller, montage document, control rig, retargeter, pose assets — read now rather than by the first Update that evaluates it, where the VFS reads ran on the game thread inside the frame. |
uint32_t | HydrateEntityTree | The same for one spawned tree — the root and every descendant. |
bool | IsEvalDuringPhysicsEnabled | a.EvalDuringPhysics: UE's parallel anim evaluation beside the physics step. |
void | DeferToPhysicsStep | |
void | KickDuringPhysics | |
void | JoinDuringPhysics | |
void | FinishAfterPhysics | |
uint32_t | GetLastDeferredCount | |
uint32_t | GetLastFootIkFinishCount | |
double | GetLastJoinWaitMs |
Function details
Initialize
void Initialize(World* world) overrideShutdown
void Shutdown() overrideUpdate
void Update(float deltaTime) overrideSetLODFocus
void SetLODFocus(const Vec3& position)Update-rate LOD (EX6, UE URO analog): animators beyond a.LODNearRadius from the focus sample every a.LODNearInterval frames (a.LODFarInterval beyond a.LODFarRadius), banking the skipped dt so animation time stays continuous. Scene feeds the main camera position each tick.
ClearLODFocus
void ClearLODFocus()GetLODSkippedCount
uint64_t GetLODSkippedCount() constNoteRendered
void NoteRendered(AnimatorComponent& animator)UE's VisibilityBasedAnimTickOption input: the scene calls this for every skinned animator it draws inside the camera frustum. With a.OffscreenInterval > 0, an animator not drawn for two updates samples at least that coarsely (dt banked). Nothing changes until a renderer has noted something, so a headless server is never throttled.
GetUpdateSerial
uint64_t GetUpdateSerial() constGetOffscreenSkippedCount
uint64_t GetOffscreenSkippedCount() constGetBudgetDeferredCount
uint64_t GetBudgetDeferredCount() constUE's AnimationBudgetAllocator: with a.BudgetMs > 0, the evaluation pass is held to that many milliseconds by deferring the lowest-priority animators (offscreen first, then by significance or focus distance) to a later frame with their dt banked. An animator is never deferred more than a.BudgetMaxDeferFrames frames in a row.
GetAverageEvalCostMs
double GetAverageEvalCostMs() constSetAverageEvalCostMsForTest
void SetAverageEvalCostMsForTest(double ms)ResolveControllerAsset
static void ResolveControllerAsset(AnimatorComponent& animator)Load the animator's authored .manim controller into controller, once. Update() calls this itself, so hydration paths only need it when they want the controller live before the first tick. A failed load is not retried — it logs once and leaves controller null.
ResolveControlRigAsset
static void ResolveControlRigAsset(ControlRigComponent& component)Load the component's authored .mcontrolrig into rig, once, off the VFS. Update() calls this in the serial gather pass so the evaluation fan-out only reads the loaded rig. A failed load logs once and leaves rig null (the animator's pose passes through untouched).
ResolveRetargeterAsset
static void ResolveRetargeterAsset(RetargetComponent& component)Load the component's authored .mretarget into options, once, off the VFS. Update() calls it in the serial gather pass, so a scene, a prefab and a runtime spawn all pick the asset up without any of them knowing it exists. A failed load logs once and leaves the in-code options standing.
HydrateAssets
static uint32_t HydrateAssets(World& world)Every asset an animator in world will need — controller, montage document, control rig, retargeter, pose assets — read now rather than by the first Update that evaluates it, where the VFS reads ran on the game thread inside the frame. Called when play starts; anything still unresolved (a later spawn) falls back to the in-frame path. Returns how many animators it touched.
HydrateEntityTree
static uint32_t HydrateEntityTree(World& world, EntityID root)The same for one spawned tree — the root and every descendant. The sector streamer calls it per restored root inside its spawn budget, so a streamed-in character's assets are read under that budget instead of by the first Update that evaluates it.
IsEvalDuringPhysicsEnabled
static bool IsEvalDuringPhysicsEnabled()a.EvalDuringPhysics: UE's parallel anim evaluation beside the physics step. The scene arms the next Update with DeferToPhysicsStep when it kicks the step asynchronously; that Update then evaluates only the animators something reads before the step (root motion the character movement consumes, morph channels the morph pass samples) and leaves the rest. KickDuringPhysics gathers and fans those out with no wait, after the DuringPhysics tick group so no actor tick touches an animator a worker holds. JoinDuringPhysics waits for them before the step's write-back moves any transform. FinishAfterPhysics then runs what needs the stepped world — foot IK raycasts and the pose after them — and the serial post-pass (leader copies, sync phases, events). Without a physics overlap the scene never arms it and Update runs everything.
DeferToPhysicsStep
void DeferToPhysicsStep()KickDuringPhysics
void KickDuringPhysics(float deltaTime)JoinDuringPhysics
void JoinDuringPhysics()FinishAfterPhysics
void FinishAfterPhysics()GetLastDeferredCount
uint32_t GetLastDeferredCount() constGetLastFootIkFinishCount
uint32_t GetLastFootIkFinishCount() constGetLastJoinWaitMs
double GetLastJoinWaitMs() const