Inherits: AnimationRootNode < AnimationNode < Resource < RefCounted < Object
A state machine with multiple AnimationRootNodes, used by AnimationTree.
Contains multiple AnimationRootNodes representing animation states, connected in a graph. State 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:
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")
C#var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback;
stateMachine.Travel("some_state");
| ||
| ||
|
void | add_node ( StringName name, AnimationNode node, Vector2 position=Vector2(0, 0) ) |
void | add_transition ( StringName from, StringName to, AnimationNodeStateMachineTransition transition ) |
get_graph_offset ( ) const | |
get_node ( StringName name ) const | |
get_node_name ( AnimationNode node ) const | |
get_node_position ( StringName name ) const | |
get_transition ( int idx ) const | |
get_transition_count ( ) const | |
get_transition_from ( int idx ) const | |
get_transition_to ( int idx ) const | |
has_node ( StringName name ) const | |
has_transition ( StringName from, StringName to ) const | |
void | remove_node ( StringName name ) |
void | remove_transition ( StringName from, StringName to ) |
void | remove_transition_by_index ( int idx ) |
void | rename_node ( StringName name, StringName new_name ) |
void | replace_node ( StringName name, AnimationNode node ) |
void | set_graph_offset ( Vector2 offset ) |
void | set_node_position ( StringName name, Vector2 position ) |
0
Seeking to the beginning is treated as playing from the start state. Transition to the end state is treated as exiting the state machine.
1
Seeking to the beginning is treated as seeking to the beginning of the animation in the current state. Transition to the end state, or the absence of transitions in each state, is treated as exiting the state machine.
2
This is a grouped state machine that can be controlled from a parent state machine. It does not work independently. There must be a state machine with state_machine_type of STATE_MACHINE_TYPE_ROOT or STATE_MACHINE_TYPE_NESTED in the parent or ancestor.
false
If true, allows teleport to the self state with AnimationNodeStateMachinePlayback.travel. When the reset option is enabled in AnimationNodeStateMachinePlayback.travel, the animation is restarted. If false, nothing happens on the teleportation to the self state.
false
If true, treat the cross-fade to the start and end nodes as a blend with the RESET animation.
In most cases, when additional cross-fades are performed in the parent AnimationNode of the state machine, setting this property to false and matching the cross-fade time of the parent AnimationNode and the state machine's start node and end node gives good results.
0
This property can define the process of transitions for different use cases. See also StateMachineType.
Adds a new animation node to the graph. The position is used for display in the editor.
Adds a transition between the given animation nodes.
Returns the draw offset of the graph. Used for display in the editor.
Returns the animation node with the given name.
Returns the given animation node's name.
Returns the given animation node's coordinates. Used for display in the editor.
Returns the given transition.
Returns the number of connections in the graph.
Returns the given transition's start node.
Returns the given transition's end node.
Returns true if the graph contains the given animation node.
Returns true if there is a transition between the given animation nodes.
Deletes the given animation node from the graph.
Deletes the transition between the two specified animation nodes.
Deletes the given transition by index.
Renames the given animation node.
There is currently no description for this method. Please help us by contributing one!
Sets the draw offset of the graph. Used for display in the editor.
Sets the animation node's coordinates. Used for display in the editor.
© 2014–present Juan Linietsky, Ariel Manzur and the Godot community
Licensed under the Creative Commons Attribution Unported License v3.0.
https://docs.godotengine.org/en/4.2/classes/class_animationnodestatemachine.html