Table of Contents

Class AnimationNodeStateMachinePlayback

Provides playback control for an AnimationNodeStateMachine.

Inheritance
AnimationNodeStateMachinePlayback

Remarks

Allows control of AnimationTree state machines created with AnimationNodeStateMachine. Retrieve with $AnimationTree.get("parameters/playback").

var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")

See Also

Methods

get_current_length

Qualifiers: 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.

float get_current_length

get_current_node

Qualifiers: 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.

StringName get_current_node

get_current_play_position

Qualifiers: const

Returns the playback position within the current animation state.

float get_current_play_position

get_fading_from_node

Qualifiers: const

Returns the starting state of currently fading animation.

StringName get_fading_from_node

get_travel_path

Qualifiers: const

Returns the current travel path as computed internally by the A* algorithm.

StringName[] get_travel_path

is_playing

Qualifiers: const

Returns true if an animation is playing.

bool is_playing

next

If there is a next path by travel or auto advance, immediately transitions from the current state to the next state.

void next

start(StringName, bool)

Starts playing the given animation.

If reset is true, the animation is played from the beginning.

void start(StringName node, bool reset)

Parameters

node StringName
reset bool

stop

Stops the currently playing animation.

void stop

travel(StringName, bool)

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.

void travel(StringName to_node, bool reset_on_teleport)

Parameters

to_node StringName
reset_on_teleport bool