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 ).
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.
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?
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.
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.
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.