Whitch is the best way to detect when animation reach its end?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hiko
:warning: Old Version Published before Godot 3 was released.

Hi! i´m looking for some help to know which is the best way to detect when animation reach its end and play another one inside the same animation node?, or to emit a signal when the current playing animation reach its end.

Thanks!

:bust_in_silhouette: Reply From: Cryingpants

If you want something to happen on the end of your animation, then you can call functions from animation. That would be the easiest solution, at least I think.

Thanks a lot!

Hiko | 2016-08-09 15:18

How exactly this can be done? I haven’t seen a way to connect a function with animation directly.

Milos Smiljanic | 2016-08-15 14:45

It’s over there:


After that you just connect it to a node with a script and you can call a func in that script

Cryingpants | 2016-08-15 14:55

Thank you very much!

Milos Smiljanic | 2016-08-18 12:36

thank you this was useful

lautar0 | 2020-05-16 19:03

Hey i can’t attach a script there Could u Help me out?

KaterGecko | 2021-12-01 00:41

(In Godot 4) If you click “Add Track”, then select “Call Method Track”, then select a node that has a script attached and then if you “Insert Key” you can choose the method to be executed then.

st_phan | 2023-05-25 06:19

:bust_in_silhouette: Reply From: volzhs

There is a many ways to play another animation when a animation ends

In editor

Using queue

get_node("AnimationPlayer").queue("New Anim (2)")

Using signal

get_node("AnimationPlayer").connect("finished", self, "do_anim_finished")

or

var anim = get_node("AnimationPlayer")
anim.connect("finished", anim, "play", ["New Anim (2)"])

Thank you very much! this is what i was looking for.

Hiko | 2016-08-09 15:18