Model

self:play_animation_layer

Shared

Plays an animation on the given layer of the model

Syntax

local status = self:play_animation_layer(
    layer,
    name,
    loop = true,
    speed = 1,
    weight = 1,
    blend_time = 0.25,
    sync = true
)

Parameters

TypeNameDescription
intlayerIndex of the animation layer to play on
stringnameName of the animation to play
boolloopWhether the animation loops
floatspeedPlayback speed multiplier
floatweightBlend weight of the layer
floatblend_timeTime in seconds to blend into the animation
boolsyncWhether the call is replicated to other peers

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Play a looping animation on layer 0
core.model.load("character", "models/character.glb")

local entity = core.model.create("character")

entity:play_animation_layer(0, "idle")
Layer an upper-body animation over a base animation
core.model.load("character", "models/character.glb")

local entity = core.model.create("character")

entity:play_animation_layer(0, "walk")
entity:set_animation_layer_filter(1, true, {"Skeleton3D:spine", "Skeleton3D:arm_l", "Skeleton3D:arm_r"})
entity:play_animation_layer(1, "wave", false, 1, 1, 0.1)

On this page