Can't get armature actions to work, what am I doing wrong?

I am trying to get bone/amature animatios to work, and I am failing.

Please find the .blend file here: https://1drv.ms/u/s!Al1ibkC5LWVVg2ZlLG4OdWQsKK8q

If I use a “regular” action (i.e. on the mesh), it is working fine. If I use an action on the armature, I get an error message and Krom hangs:

Uncaught exception: Unable to get property ‘play’ of undefined or null reference
animation.play(action,function() {
^
TypeError: Unable to get property ‘play’ of undefined or null reference
at run (krom.js:727:3)
at armory_logicnode_LogicNode.prototype.runOutput (krom.js:519:6)
at update (krom.js:684:4)
at iron_App.update (krom.js:2223:3)
at Anonymous function (krom.js:22201:3)
at kha_Scheduler.executeTimeTasks (krom.js:22085:4)
at kha_Scheduler.executeFrame (krom.js:22037:3)
at kha_SystemImpl.renderCallback (krom.js:22972:2)

The armature animation example works fine, I think I must be doing something wrong, but I can’t find out what. Could you help?

TIA,

Rob.

FWIW: I’m using macOS 10.13, Blender 2.79 (daily build) and Armory 0.6

Are you using nodes to start the animation? It looks like, from the message, that the object you are feeding to the node that attempts to play the animation is null, maybe. Like a Get Object node that is getting an object that doesn’t exist or something like that ( I haven’t looked at the blend, these are just my first thougts ).

After some more experimentation: the animation only works if I add the armature object to the Play Action node.

The Animation Actions example does not have the object names in the Play Action nodes. What is the difference between the two?

You probably applied the trait to an object other than the armature itself. I’m pretty sure that, if the object field is blank, it will just use the object that the trait is applied to. If you applied the node trait that played the actions to an object other than the armature and didn’t fill in the object, it wouldn’t work.

You’re right, I did. The node tree is attached to the scene, not the armature. Thanks for that, @zicklag

Now that I got it working, I notice something strange: regular animations stop at the last frame with a Pause Action node attached to the “done” output of the Play Action node. Bone animations revert to the first frame. How do I make them stop at the last frame?

I don’t actually know that one. :man_shrugging:

1 Like

Hello,

Not sure which armory version is this one, but following is one way working for me (sorry not using node, but haxe)

animation.play("aero", null, 0.2, 1.0, false);

It then stop after the animation last frame after it finishes playing. The key will be the last no loop flag.

From the current exposure, I am not sure if there is pause in middle of animation.

Sorry could not help with the node question as I am not experience with them.

@danilk That’s still very useful input. You can check out the code that the nodes is using ( because it is backed by Haxe ).

Here is the node code:

Looks like there isn’t a loop option for the node. That would be trivial to add ( along with animation speed ).

This is what i requested already for logic nodes
https://github.com/armory3d/armory/issues/979

After some further experimentation, it gets curiouser…

I picked up @danilk’s suggesion and added a new PlayAction node (see link below) with the extended animation.play statement.

  • for non-armature animations, the “loop” value seems to be ignored, even when I hard-code it into the haxe script as animation.play(action, null, blendTime, speed, false); instead of animation.play(action, null, blendTime, speed, loop);
  • for armature animations, the “loop” value works beautifully, animation stops on last frame

Would this be a bug?

I haven’t tried adding the whole thing to straight haxe, will try next when I find a moment or two.

Blender file and updated PlayAnimationAction node here: https://www.dropbox.com/s/yb2y6zskqetwvkk/BoneAnimTest.zip?dl=0

1 Like

That sounds like it might be a bug. If you confirm that the object and armature animations do react differently when playing them, we should open an issue on GitHub to make sure it gets addressed eventually.

Ok. I’ll raise the issue.

Edit: done, see Issue #1018

1 Like

I’m getting the same issue. How do you get animations to work with armatures? I’ve looked at the “Actions” example and it works fine ,but can’t tell why I can’t get it to work.

For me, it turned out that having a “blend” value other than 0 will play the last frames of the previous action on that same object, regardless of the play status of that action (still playing or finished). That causes weird jumps.

In your example, you’ve got the action triggered “on update”. It might be that the engine is trying to play the action (which seems to run for 200+ frames), but that it restarts on every screen refresh and you therefore effectively see nothing happening.

Could you try triggering the action “on keyboard” and see if it will play?

Yeah, tried different inputs with the same result. I think I figured out the issue. Seems you can’t use just any “action” in Armory. Looks like it’s just animated objects or bones that will play. Tried using the Modular Tree addon and the wind option. You have to manually position bones and keyframe for it to work.