AnimationNodeStateMachine

    Category: Core

    State machine for control of animations.

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

    • void add_node ( name, AnimationNode node, position=Vector2( 0, 0 ) )

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


    Adds a transition between the given nodes.


    • get_end_node ( ) const

    Returns the graph’s end node.


    • Vector2 get_graph_offset ( ) const

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



    Returns the given animation node’s name.


    • get_node_position ( String name ) const

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


    • get_start_node ( ) const

    Returns the graph’s end node.


    Returns the given transition.


    • int get_transition_count ( ) const

    Returns the number of connections in the graph.


    • get_transition_from ( int idx ) const

    Returns the given transition’s start node.


    • get_transition_to ( int idx ) const

    Returns the given transition’s end node.


    • has_node ( String name ) const

    Returns if there is a transition between the given nodes.


    • void remove_node ( name )

    Deletes the given node from the graph.


    • void remove_transition ( String from, to )

    Deletes the given transition.


    • void remove_transition_by_index ( int idx )

    Deletes the given transition.


    • void rename_node ( name, String new_name )

    Renames the given node.


    • void set_end_node ( name )

    Sets the given node as the graph end point.


    • void set_graph_offset ( Vector2 offset )

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


    • void set_node_position ( name, Vector2 position )

    • void set_start_node ( name )

    Sets the given node as the graph start point.