State machine for control of animations.
    public class AnimationNodeStateMachine : AnimationRootNode

Contains multiple nodes representing animation states, connected in a graph. Node transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the AnimationNodeStateMachinePlayback object from the AnimationTree node to control it programmatically.

Example:

[codeblock]

var state_machine = $AnimationTree.get(“parameters/playback”)

state_machine.travel(“some_state”)

[/codeblock]

Inheritance Chain

Constructors

    public AnimationNodeStateMachine()

Methods

    public void AddNode(string name, AnimationNode node, Vector2? position = default(Vector2?))

Adds a new node to the graph. The position is used for display in the editor.

    public void AddTransition(string from, string to, AnimationNodeStateMachineTransition transition)

Adds a transition between the given nodes.

    public string GetEndNode()

Returns the graph’s end node.

    public Vector2 GetGraphOffset()

Returns the draw offset of the graph. Used for display in the editor.

    public AnimationNode GetNode(string name)

Returns the animation node with the given name.

    public string GetNodeName(AnimationNode node)

Returns the given animation node’s name.

    public Vector2 GetNodePosition(string name)

Returns the given node’s coordinates. Used for display in the editor.

    public string GetStartNode()

Returns the graph’s end node.

    public AnimationNodeStateMachineTransition GetTransition(int idx)

Returns the given transition.

    public int GetTransitionCount()

Returns the number of connections in the graph.

    public string GetTransitionFrom(int idx)

Returns the given transition’s start node.

    public string GetTransitionTo(int idx)

Returns the given transition’s end node.

    public bool HasNode(string name)

Returns true if the graph contains the given node.

    public bool HasTransition(string from, string to)

Returns true if there is a transition between the given nodes.

    public void RemoveNode(string name)

Deletes the given node from the graph.

    public void RemoveTransition(string from, string to)

Deletes the given transition.

    public void RemoveTransitionByIndex(int idx)

Deletes the given transition.

    public void RenameNode(string name, string newName)

Renames the given node.

    public void SetEndNode(string name)

Sets the given node as the graph end point.

    public void SetGraphOffset(Vector2 offset)

Sets the draw offset of the graph. Used for display in the editor.

    public void SetNodePosition(string name, Vector2 position)

Sets the node’s coordinates. Used for display in the editor.

    public void SetStartNode(string name)

Sets the given node as the graph start point.

Tags: