Play animation for spawned object

Hi,

I am trying to play an animation of a spawned object but cannot get it to work.

I created an object and an armature and then parented the armature to the object. I stashed the animation in the NLA.

I then spawned a copy of my object and tried to play the animation on the spawned object (I tried this with “spawn children” as well as without). This will fail with a

Cannot read property ‘play’ of null at armory_logicnode_PlayActionNode.run :774:13)

How do I get the animation to play on a newly spawned object?

Any hints are greatly appreciated.

Hi,

Did you spawn the Mesh or the Armature of the Object in question? I believe you need to spawn Armature and since the Mesh is a child, it will be spawned too.

Thanks for the quick answer. I actually spawned the mesh. When spawning the armature I get an error as well.

I attach my .blend, this might clarify.
Pling-Animation_test.blend (624.5 KB)

So I did some checks and indeed spawning an armature results in an error. It would be great if you could open an issue over at the GitHub.

A workaround until this is fixed:

  • Parent the armature to an empty object and spawn the empty object instead.
    image

  • Then, play-action to the spawned object like so:

The modified blend file:
Pling-Animation_test_modified.blend (650.3 KB)

Thanks!

However, I found another flaw. When implementing that the spawned object will be removed after the animation is done and then calling the node many times (i.e. press space bar quickly in a row), the objects will remain in the scene.

Pling-Animation_spawn_many.blend (660.1 KB)

I guess it’s a bug, too. Any workarounds for this?

Best regards
blackno666

Any workar

A better way to accomplish what you need is like so. (I haven’t tried it though)

  • Create two Scenes, say “CircleScene” and “Scene”

  • Then, Add the following node tree to the Scene “Scene”
    image

  • Add the following node tree to the Object “Empty”

Hope this helps,

Best regards,
QC