applyAnimations

View sourceapplyAnimations(world: World): void

Samples and applies the tracks for every AnimationTarget in the world.

AnimationPlugin registers this exact function directly in AppSchedule.Update, in CoreSystems.Main when using the core schedules. A fresh Query finds AnimationPlayer and [EntityHandle, AnimationTarget] tables for this invocation. Each target’s player handle is resolved with the player query; stale or missing player entities are skipped.

For each mapped animation, the system resolves the clip from AnimationClipAssets by asset ID, gets the target’s tracks, and skips the target when no tracks are registered for its ID. It then samples every AnimationTrack at the playback’s current elapsed time and calls the track effector with the world, target entity, and sampled values. Player map order, track-array order, and query iteration order are preserved. Playback time is read as-is; this function does not advance it.

The world must contain the AnimationClipAssets resource; otherwise resource lookup throws. Every playback asset ID must also resolve to a live clip in that resource. A stale or missing asset ID is not ignored: getByAssetId() returns undefined, and the subsequent track lookup throws.

Examples

import { AppSchedule } from '@wimaengine/core'
import { applyAnimations } from '@wimaengine/animation'

// After AnimationPlugin (or equivalent setup) provides AnimationClipAssets:
app.registerSystem({
  schedule: AppSchedule.Update,
  system: applyAnimations
})
// AnimationPlugin already registers this system for its app.

Parameters

NameDescriptionDefault
world

World containing AnimationPlayer, AnimationTarget, and AnimationClipAssets state.

—