Topic was automatically imported from the old Question2Answer platform.
Asked By
ddarkmoto
HI everyone, I currently have these lines of code:
if hit == true:
state_machine.travel("death")
queue_free()
My objective is to finish the animation of a certain node before removing it from a parent node. My problem is, state_machine.travel(“death”), and queue_free() is being executed simultaneously. Is there a way to determine if the animationtree’s finished playing the animation? Thanks
You mean the AnimationPlayer, used by AnimationTree? Nope, it doesn’t return any signals when used in an AnimationTree. And AnimationTree doesn’t have signals for that.
Also is_playing() doesn’t work in AnimationTree, since it always returns TRUE.
So i think there are a lot of issues to be fixed in AnimationTree.
Kinda late but I found a solution, It’s a bit bothersome but it works
You can use a “Call Method Track” in every animation
Add a key at the end, select a method with a string parameter and write the animation name in the key “Args” section to pass it
Since I only needed it for a few animations it wasn’t that bad, but between this and other common issues like only having boolean conditionals or not being able to edit the animation speed directly without a blend node… it really screams the need for an update of the animation tree
Also, a simple solution for your problem would be to directly choose the queue_free() method in the call method track (search it at the top)