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 does not stop playing looping AnimationPlayer's Animation Playback tracks #70338

Open
Tracked by #73537
alfredbaudisch opened this issue Dec 20, 2022 · 5 comments · Fixed by #80813
Open
Tracked by #73537

Comments

@alfredbaudisch
Copy link
Contributor

alfredbaudisch commented Dec 20, 2022

Godot version

4.0-beta9

System information

Windows 10

Issue description

If a SkeletalMesh has an AnimationPlayer with a looping Animation with Animation Playback Track that loops, here called "Outer Loop":

imagen

... and the base "Loop" animation:

imagen

...then when the "OuterLoop" is played by an AnimationTree, the AnimationTree will never stop playing "Outer Loop" even after the tree reaches the end state or if you tree to transition to another state, clearly seem by this video:

animationTree-bug1.mp4

Working Scenario

As a comparison, the AnimationTree correctly transitions:

  • If you play the looping "Loop" animation directly (not via a Playback Track).
  • If you play a non-looping Animation Playback Track.

Sample working - the looping animation correctly stops:

animationTree-bug2.mp4

Steps to reproduce

imagen

Animation 1 (ex: "TurnOn)":

  • Add an AnimationPlayback Track, and insert a key playing an animation from the inherited AnimationPlayer

Animation 2 (ex: "Outer Loop)":

  • Add an AnimationPlayback Track, and insert a key playing the "Loop" animation from the inherited AnimationPlayer
  • Make the "Outer Loop" animation set to loop.

imagen

AnimationTree:

  • Add a State Machine as the root
  • Select the custom AnimationPlayer as the Anim Player param
  • Add a state for each one of the animations
  • Add a transition to End the "Outer Loop" animation
  • Then click the arrow next to End, to simulate the AnimationTree
  • State will transition until the end, but the loop will keep playing

imagen

Minimal reproduction project

Minimal reproduction project

NOTICE: the reproduction project is similar to the one from #69930 but it's adjusted here to reproduce THIS bug, the attached file is a new project for this bug.

OuterLoopAnimationDemo.zip

Updated for 4.0.1: OuterLoopAnimationDemo-4.0.1.zip

  • AnimationPlayerOriginal.tscn (red machine): the Inherited scene from the MachineMock.glb mesh, with an AnimationTree, using the original AnimationPlayer. This scene works correctly and simulates the "Working Scenario" described above.
  • AnimationPlayerCustom.tscn: the inherited scene with the steps that lead to the bug. This scene has the scenario with custom animation player and that reproduces the steps I mentioned, and it doesn't work correctly.
  • RunTest.tscn: run to see it at runtime.

The Red Machine correctly loops and stops ("Working Scenario").

The White Machine is the one bugged, it loops and never stops.

imagen

@alfredbaudisch
Copy link
Contributor Author

@TokageItLab got another one involving the machines

@TokageItLab
Copy link
Member

@alfredbaudisch Would disabling the base animation loop solve this? As the name implies, the AnimationPlaybackTrack fires the animation playback, but does not have the ability to stop the loop at will.

For example, if the length of the OuterLoop animation is longer than the Loop animation, the AnimationPlaybackTrack will not stop even if the length of the Loop animation is exceeded during playing OuterLoop.

However, if the AnimationPlayer is stopped, the AnimationPlaybackTrack playback process will stop, so I think the problem is that this behavior is not consistent with the AnimationTree. At least when the AnimationTree process is stopped, the AnimationPlaybackTrack process should also be stopped. I will look at this later.

@TokageItLab
Copy link
Member

You seem to have a similar problem to #65750: for reasons similar to those explained in #55218 (comment), it is difficult to blend them if there is only one SubAnimationPlayer whose AnimationPlaybackTrack is playing.

This means that if we stop SubAnimationPlayer when the blend amount is 0 when the two animations to be blended have an AnimationPlaybackTrack, then one of the AnimationPlaybackTracks will be stop the SubAnimationPlayer, and it will cause both AnimationPlaybackTracks to be killed.

In contrast, the workaround we can currently suggest is to insert an AnimationPlaybackTrack that commands stop, or to call a function in the signal or MethodTrack that stops the playback of the SubAnimationPlayer.

@alfredbaudisch
Copy link
Contributor Author

or to call a function in the signal or MethodTrack that stops the playback of the SubAnimationPlayer.

This works, but then unfortunately transitions and fading do not work. But at least it's a start, even though it's a temp hack.

@alfredbaudisch
Copy link
Contributor Author

I uploaded an updated MRP for 4.0.1.

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.

2 participants