Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
- Animation
- AnimationLibrary
- AnimationNode (6)
- AnimationNodeStateMachinePlayback
- AnimationNodeStateMachineTransition
- AudioBusLayout
- AudioEffect (17)
- AudioStream (10)
- BitMap
- BoneMap
- ButtonGroup
- CameraAttributes (2)
- ColorPalette
- Compositor
- CompositorEffect
- CryptoKey
- Curve
- Curve2D
- Curve3D
- EditorNode3DGizmoPlugin
- EditorSettings
- Environment
- Font (3)
- GDExtension
- GLTFAccessor
- GLTFAnimation
- GLTFBufferView
- GLTFCamera
- GLTFDocument (1)
- GLTFDocumentExtension (1)
- GLTFLight
- GLTFMesh
- GLTFNode
- GLTFPhysicsBody
- GLTFPhysicsShape
- GLTFSkeleton
- GLTFSkin
- GLTFSpecGloss
- GLTFState (1)
- GLTFTexture
- GLTFTextureSampler
- Gradient
- Image
- ImporterMesh
- InputEvent (6)
- JSON
- LabelSettings
- LightmapGIData
- Material (9)
- Mesh (4)
- MeshLibrary
- MissingResource
- MultiMesh
- NavigationMesh
- NavigationMeshSourceGeometryData2D
- NavigationMeshSourceGeometryData3D
- NavigationPolygon
- Noise (1)
- Occluder3D (5)
- OccluderPolygon2D
- OggPacketSequence
- OpenXRAction
- OpenXRActionMap
- OpenXRActionSet
- OpenXRBindingModifier (2)
- OpenXRHapticBase (1)
- OpenXRIPBinding
- OpenXRInteractionProfile
- PackedDataContainer
- PackedScene
- PhysicsMaterial
- PolygonPathFinder
- RDShaderFile
- RDShaderSPIRV
- RichTextEffect
- SceneReplicationConfig
- Script (3)
- Shader (1)
- ShaderInclude
- Shape2D (8)
- Shape3D (9)
- Shortcut
- SkeletonModification2D (7)
- SkeletonModificationStack2D
- SkeletonProfile (1)
- Skin
- Sky
- SpriteFrames
- StyleBox (4)
- SyntaxHighlighter (2)
- Texture (3)
- Theme
- TileMapPattern
- TileSet
- TileSetSource (2)
- Translation (1)
- VideoStream (1)
- VideoStreamPlayback
- VisualShaderNode (62)
- VoxelGIData
- World2D
- World3D
- X509Certificate
- AnimationNodeExtension
- AnimationNodeOutput
- AnimationNodeSync (7)
- AnimationNodeTimeScale
- AnimationNodeTimeSeek
- AnimationRootNode (5)
- AnimationNodeAnimation
- AnimationNodeBlendSpace1D
- AnimationNodeBlendSpace2D
- AnimationNodeBlendTree
- AnimationNodeStateMachine
Table of contents
-
var allow_transition_to_self: bool = false -
var reset_ends: bool = false -
var state_machine_type = STATE_MACHINE_TYPE_ROOT -
func add_node(position: Vector2 = Vector2(0, 0)) -> void -
func add_transition(transition: AnimationNodeStateMachineTransition) -> void -
const func get_graph_offset() -> Vector2 -
const func get_node(name: StringName) -> AnimationNode -
const func get_node_name(node: AnimationNode) -> StringName -
const func get_node_position(name: StringName) -> Vector2 -
const func get_transition(idx: int) -> AnimationNodeStateMachineTransition -
const func get_transition_count() -> int -
const func get_transition_from(idx: int) -> StringName -
const func get_transition_to(idx: int) -> StringName -
const func has_node(name: StringName) -> bool -
const func has_transition(to: StringName) -> bool -
func remove_node(name: StringName) -> void -
func remove_transition(to: StringName) -> void -
func remove_transition_by_index(idx: int) -> void -
func rename_node(new_name: StringName) -> void -
func replace_node(node: AnimationNode) -> void -
func set_graph_offset(offset: Vector2) -> void -
func set_node_position(position: Vector2) -> void -
const STATE_MACHINE_TYPE_ROOT = 0 enum StateMachineType -
const STATE_MACHINE_TYPE_NESTED = 1 enum StateMachineType -
const STATE_MACHINE_TYPE_GROUPED = 2 enum StateMachineType -
enum StateMachineType
AnimationNodeStateMachine #
is_refcounted, is_instantiable, resource, core, not_builtin_classes
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.
GDScript
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")C#
var stateMachine = GetNode("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback;
stateMachine.Travel("some_state"); Members #
var allow_transition_to_self: bool = 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.
var reset_ends: bool = 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.
var state_machine_type = STATE_MACHINE_TYPE_ROOT#
This property can define the process of transitions for different use cases. See also AnimationNodeStateMachine.StateMachineType.
Methods #
func add_node(position: Vector2 = Vector2(0, 0)) -> void#
Adds a new animation node to the graph. The position is used for display in the editor.
func add_transition(transition: AnimationNodeStateMachineTransition) -> void#
Adds a transition between the given animation nodes.
const func get_graph_offset() -> Vector2#
Returns the draw offset of the graph. Used for display in the editor.
const func get_node(name: StringName) -> AnimationNode#
Returns the animation node with the given name.
const func get_node_name(node: AnimationNode) -> StringName#
Returns the given animation node's name.
const func get_node_position(name: StringName) -> Vector2#
Returns the given animation node's coordinates. Used for display in the editor.
const func get_transition(idx: int) -> AnimationNodeStateMachineTransition#
Returns the given transition.
const func get_transition_count() -> int#
Returns the number of connections in the graph.
const func get_transition_from(idx: int) -> StringName#
Returns the given transition's start node.
const func get_transition_to(idx: int) -> StringName#
Returns the given transition's end node.
const func has_node(name: StringName) -> bool#
Returns true if the graph contains the given animation node.
const func has_transition(to: StringName) -> bool#
Returns true if there is a transition between the given animation nodes.
func remove_node(name: StringName) -> void#
Deletes the given animation node from the graph.
func remove_transition(to: StringName) -> void#
Deletes the transition between the two specified animation nodes.
func remove_transition_by_index(idx: int) -> void#
Deletes the given transition by index.
func rename_node(new_name: StringName) -> void#
Renames the given animation node.
func replace_node(node: AnimationNode) -> void#
Replaces the given animation node with a new animation node.
func set_graph_offset(offset: Vector2) -> void#
Sets the draw offset of the graph. Used for display in the editor.
func set_node_position(position: Vector2) -> void#
Sets the animation node's coordinates. Used for display in the editor.
Annotations #
Constants #
const STATE_MACHINE_TYPE_ROOT = 0 enum StateMachineType#
Seeking to the beginning is treated as playing from the start state. Transition to the end state is treated as exiting the state machine.
const STATE_MACHINE_TYPE_NESTED = 1 enum StateMachineType#
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.
const STATE_MACHINE_TYPE_GROUPED = 2 enum StateMachineType#
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.
Constructors #
Enums #
StateMachineType#
enum StateMachineType {
STATE_MACHINE_TYPE_ROOT = 0,
STATE_MACHINE_TYPE_NESTED = 1,
STATE_MACHINE_TYPE_GROUPED = 2,
}