Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimationTree`s animation started event notification bug (does not work with looped animations) #76159

Open
ilievmark opened this issue Apr 17, 2023 · 5 comments · May be fixed by #89525
Open

Comments

@ilievmark
Copy link

Godot version

4.0.2 mono

System information

Mac OS Ventura 13.2.1

Issue description

In class AnimationTree there are events: AnimationStarted and AnimationFinished. Both expected to be invoked whenever animation tree plays another animation or finishs it. For regular animations they are working fine. But if your state machine has looped animations, you wont be notified through both events. See screenshots and attached project

Screenshot 2023-04-17 at 10 02 38

Screenshot 2023-04-17 at 10 02 57

Steps to reproduce

Steps to reproduce:
Download character body from Mixamo
Download set of animations from Mixamo
Build animations and character body to glb files with Blender (separatelly)
Import those animations to projects as animation library
While import animations, set some animations Loop mode to Linear
Create character scene, add there character body, shape and imported skeleton from Mixamo
Add animation libraries to anim player
Add AnimationTree and setup some animations using state machine (idle (no loop) -> idle (no loop) -> running (loop))
Add script for your character body, get animation tree and subscribe on event AnimationStarted or AnimationFinished

Expected behavior:
Being notified whenever looped animation started or finished (through sync transition condition interuption for example)

Actual behavior:
When looped animation started, no event from event AnimationStarted.
If you setup exit from state via sync transition with condition, you will not receive AnimationFinished event notification on animation interuption

Minimal reproduction project

Compatibility type: Compatibility
Environment: .Net 6 or 7, C#

(see 'example.zip' with projects setup)
example.zip

@ilievmark ilievmark changed the title AnimationTree animation started event notifications bug AnimationTree`s animation started event notification bug (does not work with looped animations) Apr 17, 2023
@Calinou
Copy link
Member

Calinou commented Apr 17, 2023

I believe looping animations don't emit animation_finished by design. This is also the case in AnimationPlayer.

Changing this would be considered compatibility-breaking at this point, as many people rely on the existing behavior. We could avoid compatibility breakage by adding a new signal such as animation_looped, while keeping the existing signal's behavior as-is.

@ilievmark
Copy link
Author

ilievmark commented Apr 17, 2023

animation_finished for looping animation - well, may be the case
but after all, animation_started should appear in the case, right? we starts the looping animation anyway

@ilievmark
Copy link
Author

ilievmark commented Apr 17, 2023

still, there may be the same idea for animation_finished looping animation case.
we brake it, may we consider then that its finished?
or there should be another event - animation_braked?

@ilievmark
Copy link
Author

ilievmark commented Apr 17, 2023

@Calinou
then, is there any kind of way I can know if looped animation started to play in AnimationTree?
just anything, may be I can create my own observer, its ok, but I need any kind of point of system that can tell me if looped one started.
P.S. tried animation player, not a case either
thank you in advance

@valkyrienyanko
Copy link

Hello, just wanted to say this issue is becoming a big problem for me. I need to know when the "rest" animation is started in script but since it's looped I have no way of knowing when this happens because of this issue.

If anyone knows of a workaround for this please tell me!

Untitled

@Calinou Calinou linked a pull request Mar 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants