AnimationNodeStateMachinePlayback
Inherits: Resource < Shared < Object
Provides playback control for an AnimationNodeStateMachine.
Description
Section titled “Description”Allows control of AnimationTree state machines created with AnimationNodeStateMachine. Retrieve with $AnimationTree.get("parameters/playback").
use actor::AnimationTree as animation_tree : AnimationTree
fn _ready() void { state_machine : AnimationNodeStateMachinePlayback = animation_tree.get("parameters/playback") as AnimationNodeStateMachinePlayback state_machine.travel("some_state")}Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| bool | resource_local_to_scene | true |
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| float | get_current_length() |
| StringName | get_current_node() |
| float | get_current_play_position() |
| float | get_fading_from_length() |
| StringName | get_fading_from_node() |
| float | get_fading_from_play_position() |
| float | get_fading_length() |
| float | get_fading_position() |
[]StringName | get_travel_path() |
| bool | is_playing() |
| void | next() |
| void | start(node, reset) |
| void | stop() |
| void | travel(to_node, reset_on_teleport) |
Signals
Section titled “Signals”state_finished
Section titled “state_finished”state_finished(state: StringName)Emitted when the state finishes playback. If state is a state machine set to grouped mode, its signals are passed through with its name prefixed.
If there is a crossfade, this will be fired when the influence of the get_fading_from_node() animation is no longer present.
state_started
Section titled “state_started”state_started(state: StringName)Emitted when the state starts playback. If state is a state machine set to grouped mode, its signals are passed through with its name prefixed.
Property descriptions
Section titled “Property descriptions”resource_local_to_scene
Section titled “resource_local_to_scene”bool resource_local_to_scene = true
Setter/getter: set_local_to_scene(), is_local_to_scene()
No description yet.
Method descriptions
Section titled “Method descriptions”get_current_length
Section titled “get_current_length”float get_current_length() const
Returns the current state length.
Note: It is possible that any AnimationRootNode can be nodes as well as animations. This means that there can be multiple animations within a single state. Which animation length has priority depends on the nodes connected inside it. Also, if a transition does not reset, the remaining length at that point will be returned.
get_current_node
Section titled “get_current_node”StringName get_current_node() const
Returns the currently playing animation state.
Note: When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins.
get_current_play_position
Section titled “get_current_play_position”float get_current_play_position() const
Returns the playback position within the current animation state.
get_fading_from_length
Section titled “get_fading_from_length”float get_fading_from_length() const
Returns the playback state length of the node from get_fading_from_node(). Returns 0 if no animation fade is occurring.
get_fading_from_node
Section titled “get_fading_from_node”StringName get_fading_from_node() const
Returns the starting state of currently fading animation.
get_fading_from_play_position
Section titled “get_fading_from_play_position”float get_fading_from_play_position() const
Returns the playback position of the node from get_fading_from_node(). Returns 0 if no animation fade is occurring.
get_fading_length
Section titled “get_fading_length”float get_fading_length() const
Returns the length of the current fade animation. Returns 0 if no animation fade is occurring.
get_fading_position
Section titled “get_fading_position”float get_fading_position() const
Returns the playback position of the current fade animation. Returns 0 if no animation fade is occurring.
get_travel_path
Section titled “get_travel_path”[]StringName get_travel_path() const
Returns the current travel path as computed internally by the A* algorithm.
is_playing
Section titled “is_playing”bool is_playing() const
Returns true if an animation is playing.
void next()
If there is a next path by travel or auto advance, immediately transitions from the current state to the next state.
void start(node: StringName, reset: bool = true)
Starts playing the given animation.
If reset is true, the animation is played from the beginning.
void stop()
Stops the currently playing animation.
travel
Section titled “travel”void travel(to_node: StringName, reset_on_teleport: bool = true)
Transitions from the current state to another one, following the shortest path.
If the path does not connect from the current state, the animation will play after the state teleports.
If reset_on_teleport is true, the animation is played from the beginning when the travel cause a teleportation.