Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit65083fe8f2

README.md

animation.play

Play one .animation clip on an entity's skinned body for a test window, then clean up.

animation.play(animation, entity, opts?)
  • animation — clip identity, name, or AssetRef<animation>.
  • entity — entity id, name, or EntityRef. The tool finds the first SkinnedModel on it or under it (the imported-character layout puts the rigged mesh on a child) and drives that body.
  • opts — optional:
    • offset — seconds (5) or a string ("5s", "500ms") to wait before the clip starts. The lookups happen immediately; only the playback is delayed.
    • loop — wrap the clip. Default false (play once).
    • duration — seconds to hold the play window. Default: one clip length for a one-shot, or 5 when looping.
    • speed — playback rate multiplier.
    • sourceRig — override the clip's recorded source rig.

Returns { ok = true, entity, skinnedModel, clip, offset, loop } once scheduled, or { ok = false, error } when the clip, the entity, or a SkinnedModel under it cannot be found. Playback errors after the offset (an unreadable clip, a rig with no shared roles) are logged, not returned — the lookups are the returned contract.

Plays while the world runs (play mode). For durable playback author a ClipPlayer component instead; this tool leaves nothing behind and does not disturb an animation the body already runs.