New Animation Tree & State Machine for Godot

Godot has been updated, getting the rewritten animation tree.

Godot has been updated, getting the rewritten animation tree. Let’s check out the engine’s new features to see how it can help you develop complex 3D games.

COMPLETELY MODULAR DESIGN

There is a new node, AnimationTree. It does nothing by itself, so a tree root needs to be set to it:

animtree.png

There are plenty of nodes to put in the tree, but only a few root nodes are valid by default:

  • Animation (a regular animation)
  • BlendTree (A blend tree, similar to the previous AnimationTreePlayer)
  • BlendSpace1D and BlendSpace2D, for visual blend spaces.
  • StateMachine (a state machine)

Save for animation, any of those nodes can contain other types of nodes. Detail is as follows:

BLEND TREE

This node is similar to the old AnimationTreePlayer. It’s a run of the mill animation blend tree. Nodes have inputs and outputs and can be blended. This new implementation has a lot of visual feedback, though:

oneshot.gif

Animations show their progress with a proper bar, and active wires become blue.

It is also possible to use blend spaces, state machines and even other blend tree as sub-nodes. In the example below, two state machines are blended via a Blend2 node, with filters set. This way, a functionality similar to state machine layers (from other engines) can be achieved easily.

filter.png

BLEND SPACE 1D AND 2D

With the help of Thomas Herzog, both 1D and 2D blend spaces are supported in Godot.

blendspaces.gif

For the 2D version, an automatic triangulation option is set by default (which can be changed to manual if required). Other engines hide it by default, but we believe it should be better that users see how blending happens behind the scenes (As well as having the freedom to change it ):

auto_triangles.gif

STATE MACHINE

Finally, Godot introduces a state machine. This state machine is rather simple but very efficient, and relies on the concept of travel.

state_machine2.gif

Conditions to change states are not supported but can be easily scripted by adding scripted transitions (we’ll see in the future whether this is worth adding to the core or can remain an extension).

CUSTOM BLEND NODES

You can add your own custom blending logic with the new Godot API, even writing your own state machine. The new API is very easy to extend and use:

api.png

ROOT MOTION

It is also easy to set a track as root motion. If set as such, a transform with the motion for the frame can be obtained and used as well. A new node RootMotionView was added to aid in debugging root motion.

root_motion.gif

COMPATIBILITY

The old animation system (AnimationTreePlayer) has now been deprecated and will be removed in future versions. By the time, we will add a compatibility API so they get converted to the new system.

You can learn more about the update here

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more