natiny.animator.create

Lua
natiny.animator.create(model [, animation]) -> animator

Creates a layer of animation on a model whose mesh has a skeleton.

Parameters

Name Type Default Description
model number Model handle from natiny.model.create; its mesh must have a skeleton
animation number or string nil Clip from the model's mesh, by handle or name, to start immediately

Returns

Type Description
number Animator handle; raises an error when the model is invalid, has no skeleton, or the animator cannot be allocated

Example

Lua
local legs = natiny.animator.create(hero, "Running")

local arms = natiny.animator.create(hero)
natiny.animator.set_mask(arms, "Torso", true)
natiny.animator.set_order(arms, 1)

Notes

  • An animator is not an entity, cannot be parented, and is destroyed with its model.