• Godot Help
  • How to tell when animation finishes inside AnimationNodeBlendTree?

I've created an AnimationTree that contains a AnimationNodeBlendTree to control all the animations on my 3D character. One of the nodes is my tree is for the character dying, which I've implemented as a Transition node named 'dead'. When I set its state to 'dead' in code, the dying animation is played and it ends with the model lying still on the ground. At this point, I want to code to check that the animation has finished playing so that I can queue the enemy character for deletion. How can I check if this node has finished playing so that I can delete it from my scene?

I should add that the animations are imported from a Blender file, so I cannot manually edit them inside Godot to add things like function calls. Also, the death animation does not loop, so it holds on the last frame when it finishes.

Godot version? 3.x you would likely have to use a AnimationPlayer call method track and key the last frame. In godot 4 I think there should be a real solution rather than a hacky workaround for it now.

    Megalomaniak Yes, I m using version 3.5. I can't add a call method track to the AnimationPlayer because I'm using the AnimationPlayer that was imported from Blender and can't alter it. And AnimationTree doesn't seem to let you use multiple AnimationPlayers.

    You can still add call method track to the end of your death animation. It doesn't effect how your animation plays, it just an extra track on that animation timeline so your can keyframe the point where you want a function on it.

    Click add track (+) on your Death Animation Timeline > Call method track > then Add a keyframe > Choose your object > Choose a function to add (You can add your custom function to the list as well)

    Another way to try is on_animation_finished signal (Select AnimationPlayer > Node Tab )