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 StateMachine transition animation reset behaves weird depending on blend position #93136

Closed
Rooni opened this issue Jun 13, 2024 · 1 comment · Fixed by #93185
Closed

Comments

@Rooni
Copy link

Rooni commented Jun 13, 2024

Tested versions

  • Reproducable on Godot Engine v4.3.dev6.official [89850d5]

System information

Windows 11

Issue description

A BlendSpace2D with a transition configured to reset the animation, does not reset the animation depending on if the blend_position changed.
Whenever the blend_position stays the same, the animation is properly started at 0, if the blend_position is different, the animation is started somewhere inbetween the start and end, causing keyframes to not trigger, in this case a texture only gets set after the animation restarts naturally.

Steps to reproduce

  1. Create an AnimationPlayer and set up some animation that set a texture on the first keyframe.
  2. Create an AnimationTree with two BlendSpace2Ds, for idle and moving. Set up the blendspaces with animations for each direction. Set the blend mode to CA (BLEND_MODE_DISCRETE_CARRY )
  3. Set up a script that sets the blend position and a way to transition between the two states.
  4. Run the project and see that the texture only changes when the blend position remains the same between states.

Minimal reproduction project (MRP)

This project demonstrates the issue with a progress bar (the progress in the animation), and two color changing cubes with a different color for each direction.

The top cube is a ColorRect, and the bottom a Sprite2D.
Animations with keyframes are set up to change the appearance of both cubes, but the Sprite2D only changes whenever the animation actually passes the keyframe, to demonstrate it changing only after the animation ended and starts to loop.

The expected behavior is that both cubes instantly change color (through the keyframe at 0), whenever any direction is pressed.
What actually happens is, the animation doesn't start from 0 when the blend position changes.

Pressing only one direction (eg. right, right, right, right), shows the animation properly resetting to 0.
Alternating directions causes the animation to not start from 0, causing the color change to be delayed until the animation loops.

mrp-blend-position-bug.zip

@TokageItLab
Copy link
Member

Although the behavior of dev6 and the current master is different, I found a bug in the force continous behavior nonetheless, so I sent a fix as #93185.

@TokageItLab TokageItLab added this to the 4.3 milestone Jun 15, 2024
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