Animation in Armory

In this tutorial, we are going to look at using animations in Armory. The truth of the matter is, using animations is incredibly simple, but creating a compatible Blend file can perhaps be the biggest challenge.

To work around this problem I have provided the simple blend file used in this example. It contains a properly configured Blender file with an armature with two named animations as well as two markers. If you are having issues, download it and start from there.

Let’s start with the easy part, playing an animation using Nodes

Animation using nodes - Armory3D

Yeah, it’s that simple. When the user presses the 1 key, the bend animation is played. When the 2 key is pressed, the Idle animation is played. The node powering it all is the Play Action node with the important parameter being the animation name. The Blend value determines how smoothly the animations are blended when switching from one action to the other. Here is the example running:

Animation Armory3D

It’s also possible to trigger functions using Action Markers as part of the animation. When a marker is hit you can respond by adding whatever logic you want, enabling you do to things like trigger sound effects when the marker is hit, or any other game logic you want to integrate with the animation. Responding to markers is as simple as:

Responding to Markers - Animation Armory3D

The following Haxe code accomplishes the same thing as the above nodes:

notifyOnUpdate(function() {
        trace("Playing animation bend");"Bend",function(){
          trace("Bend animation done");
        trace("Playing animation idle");"Idle",function(){
          trace("Idle animation done");

Now the challenge is properly setting up the animations. First off in Blender, you need to set your animations up as actions like the following:

Animation Action - Armory3D

Actions can be created using the NLA Editor in Blender. The details of creating actions is well beyond the scope of this tutorial. If you want a specific tutorial showing how to create actions using Blender, let me know in the comments below. The other thing to note is the red dashed line, those are markers that have been made local. To learn more about creating and working with markers check this link from the Blender documentation. If you encounter a problem with your animation in Armory, chances are it’s your Blender animation and not your Armory code.


Like what you see?...pass it on!

Scroll to Top