*For Godot 4 Beta 1 Replace lerp() with lerpf()
Hi, Here is a quick beginner manual for using AnimationTree and use it to Blend between your animations. Warning I'm not much of a teacher 😅 Here I use GD4 but GD3 is pretty much the same.
You should already be familar with:
Godot User interface
Export/Import your 3D Model
AnimationPlayer
lerp()
First, using AnimationTree with "AnimationNodeStateMachine"
1. Add AnimationTree to your Player
2. In AnimationTree Panel:
-Choose AnimationNodeStateMachine as your Tree Root
-Assign your Player's AnimationPlayer
-Tick Active
3. Build your Animation StateMachine by:
3.1 To Add Animation
-Choose the first icon (The Arrow Pointer)
-Right Click empty area
-Add your Animations
3.2 To Link Animations
-Choose the 3rd icon
-Click to Drag and Link your Animations
3.3 To Blend Animation
-First select your Link
-Go to Properties and Increase "Xfade Time"
4. Code your Animation:
-By using the travel() and enter your animation's name, the AnimationTree's "playback" will travel to and play that animation. The Xfade Time you set will do the Blending for you. So just add the code to each input, for example.
if Input.is_action_pressed("forward"):
input.z += 1
$AnimationTree["parameters/playback"].travel("walk")
4.1 I'm just showing the location of AnimationTree's "parameters/playback" that the code controls. Don't need to do anything.
PS There are other ways to code your animation, depends on how you set up your input for example. This is just quickest, easiest to show how it works.
If I made mistakes please let me know.