Skip to content

Search

Documentation

state_machine

Switches an animation player between clips. start is the first state, [states] maps states to clips or to nested machines, each [[transitions]] entry…

Files live in animations/. Used by state_machine · machine.

Switches an animation player between clips. start is the first state, [states] maps states to clips or to nested machines, each [[transitions]] entry names from, to, blend_time, ease or blend_curve, advance_mode, switch_mode, condition, check, priority, reset and break_loop_at_end. A transition to end stops the machine until a travel or a jump.

type = "state_machine"
start = "idle"

[states]                         # state = clip in the player's library; "" is the state's own name
idle = "idle"

[states.move]                    # a nested machine: its states are move/walk and move/run
start = "walk"
states = { walk = "", run = "run_cycle" }

[[transitions]]
from = "idle"
to = "move"                      # entering a nested machine enters its start
blend_time = 0.2                 # seconds
ease = "in_out_sine"             # the curve the blend follows; linear by default
advance_mode = "auto"            # disabled, enabled (fires on animation.travel) or auto
switch_mode = "immediate"        # immediate, sync (keeps the playhead) or at_end
condition = "moving"             # turned on by animation.set_condition
check = "can_move"               # a script method that has to answer true, asked each frame
priority = 1                     # lower wins among auto transitions and on travel
reset = true                     # false resumes where the state was last left
break_loop_at_end = false        # true holds a looping clip's end while it blends out

[[transitions]]
from = "move"                    # leaves from any state inside the nested machine
to = "end"
blend_curve = [[0.0, 0.0], [0.3, 0.8], [1.0, 1.0]]   # [u, weight] points, in place of ease