state_machine
Runs the state_machine asset in machine over the player node's clips. auto transitions fire when their conditions come on; animation.travel moves to a…
On this page
animation · 4 properties · Animation
Runs the state_machine asset in machine over the player node's clips. auto transitions fire when their conditions come on; animation.travel moves to a state.
In a scene, state_machine is the node key that applies it. A script reaches each property below as a field on node.state_machine: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.state_machine.get() and node.state_machine.set(table).
Properties
| property | type | default | description |
|---|---|---|---|
check_node |
node | — | The node whose script answers the transitions' check methods; empty means this node |
enabled |
bool | true |
Whether the machine is running |
machine |
asset · state_machine |
— | The state machine to run |
player |
node | — | The animation player it drives; empty means this node |
Asset types this component references: state_machine.
Script functions
Methods of node.state_machine, the handle a node carrying this component exposes. Every handle also has get(), set(table), patch(table), has() and remove().
From animation:
| method | what it does |
|---|---|
current_state() -> any |
The state the machine is in, or nil before it has entered one. |
jump(string) |
Cut the state machine to the named state on the next step, with no fade. |
set_condition(string, bool) |
Turn on or off a condition that auto transitions wait on. |
travel(string) |
Head for the named state through the cheapest chain of transitions, each costing its priority and fading as it says; a state no transition reaches is cut to directly. |