Skip to content
← Back to Blog 3d-modeling

Godot 4 AnimationTree: The Complete Guide to Character Animations for Game Devs

By BitSoul3D5 min read990 views

Most game devs import their first animated character into Godot, hit play, and watch it T-pose into oblivion. The animations are there — they just aren't wired up. That's where AnimationTree comes in, and once you understand it, character animation in Godot 4 becomes one of the most powerful tools in your toolkit.

Godot 4 AnimationTree: The Complete Guide to Character Animations for Game Devs

What Is AnimationTree and Why Does It Matter?

Godot 4's AnimationTree node is a state machine and blend controller that sits on top of your AnimationPlayer. Instead of scripting animation transitions by hand with play() calls, you build a visual graph of states and blends that the engine evaluates every frame.

The key advantages:

Skipping AnimationTree and writing raw AnimationPlayer calls works for simple prototypes, but collapses fast once you have more than three or four states. Don't skip it.

Setting Up AnimationTree on an Imported Character

Assume you have a humanoid character imported as a .glb or .fbx with embedded animations. Here's the setup:

  1. Add an AnimationPlayer node as a child of your character's root node (Godot auto-creates this on GLB import).
  2. Add an AnimationTree node as a sibling (same level as AnimationPlayer).
  3. In the AnimationTree inspector, set Anim Player to point to your AnimationPlayer.
  4. Set Tree Root to AnimationNodeStateMachine.
  5. Enable Active (the tree won't run otherwise — easy to miss).
# In your character script, get a reference to the tree
@onready var anim_tree: AnimationTree = $AnimationTree
@onready var state_machine = anim_tree["parameters/playback"]

func _ready():
    anim_tree.active = true

func _physics_process(delta):
    if velocity.length() > 0.1:
        state_machine.travel("Walk")
    else:
        state_machine.travel("Idle")

The travel() method tells the state machine to move toward a target state, respecting any transition conditions you've set in the graph.

Setting Up AnimationTree on an Imported Character — illustrated

Building a Locomotion Blend Space

A BlendSpace2D lets you blend between multiple animations based on two axes — typically horizontal and vertical movement. This is how you get smooth 8-directional movement without 8 separate animation states.

In the AnimationTree editor:

  1. Add a BlendSpace2D node inside your state machine.
  2. Set the X axis to strafe (–1 left, +1 right) and Y axis to forward (–1 back, +1 forward).
  3. Place your animations at corresponding coordinates: Idle at (0,0), WalkForward at (0,1), WalkBack at (0,–1), StrafeLeft at (–1,0), etc.
  4. In code, update the blend position every frame:
func _physics_process(delta):
    var input_dir = Vector2(
        Input.get_axis("move_left", "move_right"),
        -Input.get_axis("move_forward", "move_back")
    )
    anim_tree.set("parameters/Locomotion/blend_position", input_dir)

Godot interpolates between the surrounding animation points automatically. At (0.5, 0.7), for instance, you get a smooth blend of forward walk and right strafe — no extra code required.

Transition Conditions and Auto-Advance

For state transitions in the state machine graph:

Set conditions using expressions (parameters/conditions/is_grounded) or leave them blank and use travel() from code.

Transition Conditions and Auto-Advance — illustrated

Root Motion: Moving Characters with Animation Data

Root motion lets the animation itself drive the character's world position, rather than your movement code. This is critical for realistic acceleration, stopping animations, and complex actions like climbing or dodge rolls.

Enable it in the import settings of your .glb/.fbx:

  1. Select your model in the FileSystem panel → Import tab.
  2. Under Animation, enable Root Motion Track.
  3. Re-import.
  4. In AnimationTree, enable Root Motion Track and set the track path to your root bone (usually Root or Hips).
  5. In your character script, apply the extracted motion:
func _physics_process(delta):
    # Get the root motion transform from the tree
    var root_motion = anim_tree.get_root_motion_position()
    # Apply it relative to character facing direction
    velocity = global_transform.basis * (root_motion / delta)
    move_and_slide()

This approach is more work upfront but produces dramatically more realistic character movement, especially for action games.

Common Pitfalls and How to Avoid Them

ProblemCauseFix
Character T-poses on startAnimationTree.active is falseSet active = true in _ready()
Animations snap instead of blendBlend time set to 0Set transition blend to 0.15–0.25s
Root motion teleports characterRoot motion applied without deltaDivide get_root_motion_position() by delta
State machine ignores travel()Wrong playback path stringUse parameters/playback exactly
Blend space looks roboticToo few blend pointsAdd diagonal animations (WalkForwardLeft, etc.)
Import loses animationsGLB re-imported without Animation enabledCheck Import tab → Animations → Import

Sourcing Production-Ready Animated Characters

Building an AnimationTree is fast. Rigging and animating a character from scratch is not. For indie studios and solo devs, the smart move is to source pre-rigged, pre-animated characters and focus your time on game mechanics.

The BitSoul marketplace carries humanoid characters with Mixamo-compatible rigs and GLB exports that drop directly into Godot 4 with all animations intact. No re-rigging, no baked-in incompatibilities — just import and wire up the AnimationTree.

When evaluating any animated asset, check for:

Wrapping Up

Godot 4's AnimationTree has a learning curve, but the payoff is a character animation system that scales from a 3-state platformer controller to a full action RPG blend graph. Get the state machine running, add a blend space for locomotion, and layer in root motion when precision movement matters.

For pre-animated characters, rigs, and game-ready assets that work with this workflow out of the box, visit BitSoul — built specifically for indie devs who need quality assets without the pipeline overhead.


This post is part of the Ultimate Guide to Free 3D Game Assets — BitSoul's complete reference for formats, texturing, rigging, optimization, and engine integration.


Build with real assets: grab the 98-model Character Pack on the BitSoul marketplace and drop them straight into your project.

Tags: characters

Skip the modeling — download it instead

A free BitSoul3D account gets you 2 GLB downloads every month for personal use plus 25 one-time AI Engine credits, no card required. PBR-textured GLB downloads with a full 3D preview before you buy, for Unreal, Unity, Godot or Blender — OBJ and 3D-printable STL come with any purchase or paid plan.

Browse 1,051 models — from $4.99 → or start free (2 downloads a month)