What is an AnimationTree?
- Game Development course
- Expert
- Lesson 25/47
- 4 min
Learn that AnimationTree is a state-machine animation manager.
What is AnimationTree?
AnimationTree is a Godot node that manages animations with state machines. It sits next to AnimationPlayer and decides which animation plays when. It organizes character movements with states and transitions.
var agac = $AnimationTreeThanks to this node animations can be managed independently from code.
The state machine
A state machine is a structure where animations are organized as different states. Each state corresponds to an animation clip. Transitions between states are defined with rules in the AnimationTree editor.
var playback = agac.get("parameters/playback")This structure organizes the flow of animations.
Practice Connect the AnimationTree
In a script named AgacKurulum, define a variable named agac of type AnimationTree. In the _ready method assign the $AnimationTree node to this variable and print the text "Agac hazir" with print.
Starter code
extends Node
# agac adli AnimationTree tipinde degiskeni tanimla
func _ready():
# agac degiskenine $AnimationTree dugumunu ata
# "Agac hazir" metnini yazdirSample solution
extends Node
var agac: AnimationTree
func _ready():
agac = $AnimationTree
print("Agac hazir")Expected output
Agac hazir
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What is the main task of AnimationTree?
- Storing animation clips
- Managing animations with state machines Correct answer
- Loading texture files
- Computing scene lights
Explanation: AnimationTree manages the order and transitions of animations through state machines.
2 Write the variable type
var agac: ____
var agac: AnimationTree
Explanation: In Godot, the node type that represents the animation tree is AnimationTree.
3 AnimationTree terms
| Term | Meaning |
|---|---|
AnimationTree |
State machine based animation manager |
Durum makinesi |
Organizes animations as states |
Godot |
An open source game engine |
Geçiş |
Going from one state to another |