Table of Contents

Class AnimationNodeStateMachinePlayback

Namespace
Godot
Assembly
GodotSharp.dll

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

Example:

var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback").As<AnimationNodeStateMachinePlayback>();
  stateMachine.Travel("some_state");
public class AnimationNodeStateMachinePlayback : Resource, IDisposable
Inheritance
AnimationNodeStateMachinePlayback
Implements
Inherited Members

Constructors

AnimationNodeStateMachinePlayback()

public AnimationNodeStateMachinePlayback()

Methods

GetCurrentLength()

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.

public float GetCurrentLength()

Returns

float

GetCurrentNode()

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.

public StringName GetCurrentNode()

Returns

StringName

GetCurrentPlayPosition()

Returns the playback position within the current animation state.

public float GetCurrentPlayPosition()

Returns

float

GetFadingFromNode()

Returns the starting state of currently fading animation.

public StringName GetFadingFromNode()

Returns

StringName

GetTravelPath()

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

public Array<StringName> GetTravelPath()

Returns

Array<StringName>

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsPlaying()

Returns true if an animation is playing.

public bool IsPlaying()

Returns

bool

Next()

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

public void Next()

Start(StringName, bool)

Starts playing the given animation.

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

public void Start(StringName node, bool reset = true)

Parameters

node StringName
reset bool

Stop()

Stops the currently playing animation.

public 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 resetOnTeleport is true, the animation is played from the beginning when the travel cause a teleportation.

public void Travel(StringName toNode, bool resetOnTeleport = true)

Parameters

toNode StringName
resetOnTeleport bool