Builtin Library
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, orAssetRef<animation>.entity— entity id, name, orEntityRef. The tool finds the firstSkinnedModelon 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. Defaultfalse(play once).duration— seconds to hold the play window. Default: one clip length for a one-shot, or5when 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.