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 incorrectly transitions Skeletal Mesh animations if the AnimationPlayer is not the one inherited from the GLTF #69930

Closed
alfredbaudisch opened this issue Dec 11, 2022 · 1 comment · Fixed by #69932

Comments

@alfredbaudisch
Copy link
Contributor

alfredbaudisch commented Dec 11, 2022

Godot version

4.0-beta8

System information

Windows 10

Issue description

Consider the setup: a Skeletal Mesh with Animations, thus having an Inherited AnimationPlayer, and then you create another AnimationPlayer, with tracks that play animations from the inherited AnimationPlayer and/or additional custom tracks, such as CallMethod tracks.

Then if you call the animations from the custom AnimationPlayer with a State Machine AnimationTree, the AnimationTree does not interpolate the transitions between the animations correctly, creating either "stuck" frames or freezing the 1st animation before transitioning to the next one.

If you play animations from the inherited AnimationPlayer (the animations from the mesh, with nothing else), then the AnimationTree correctly transitions.

My current example

  • This machine has a "TurnOn" and a "Loop" animation, imported from Blender.
  • By adding the TurnOn animation to a custom AnimationPlayer, when transitioning to the Loop animation, something very strange happens with the engine (the gray one) which it gets stuck down ("crying engine") and then the looping animation does not play.
  • In the video, after showing the "crying engine", I show the loop animation which was supposed to play.
  • It can be hard to reproduce this, so my reproducible project mimics the issue using the same scenario (an engine with TurnOn and Loop animations).
MoendaDiesSad.mp4

Steps to reproduce

  • Import a skeletal mesh with at least two animations
  • Created an Inherited Scene from the Mesh
  • Add a script to the inherited scene and add any method for it
  • Add an AnimationTree and an AnimationPlayer
  • Create two animations in the AnimationPlayer

imagen

Animation 1 (ex: "TurnOn)":

  • Add an AnimationPlayback Track, and insert a key playing an animation from the inherited AnimationPlayer
  • Add a CallMethod track and call the method you added to the scene before

imagen

Animation 2 (ex: "Loop)":

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

imagen

AnimationTree:

  • Add a State Machine as the root
  • Select the custom AnimationPlayer as the Anim Player param
  • Add a state for each one for the animations, being the animation with CallMethod the 1st one and then an At End, Auto Advance transition that transitions to the other one

imagen

Test:
If you test, the 1st animation "TurnOn":

  • Won't play
  • or will get stuck
  • or will cause bad interpolation to the next animation.

But if you manually play the custom "TurnOn" animation added before, it plays correctly. Then in the AnimationTree, it doesn't.

Minimal reproduction project

EventInAnimationDemo.zip

  • AnimationPlayerOriginal.tscn (red machine): the Inherited scene from the MachineMock.glb mesh, with an AnimationTree, using the original AnimationPlayer. This scene works correctly.
  • 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 plays turn on then transitions to loop, but then it can't have custom animation tracks.

The white machine is the one bugged, you can see the Turn On animation does not play and the machine gets stuck and then jumps to the loop animation.

imagen

@TokageItLab
Copy link
Member

TokageItLab commented Dec 11, 2022

Probably a regression by #69336. It seems to be failing to get the first key. I forgot to apply fix #69588 to AnimationTrack, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants