You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying an Animation Tree mixing simple animation nodes and sub-state machine nodes:
a sub-state node Stand containing sub-states Idle and Run
simple nodes like Attack (one-time) and Crouch (looping)
I have a transition from Stand to Crouch and Crouch to Stand (the top-level node, but could also be with Stand/Idle), with an expression condition. When the condition is true, I switch from Stand/Idle to Crouch immediately, as expected. When the condition is false, I go back to Stand/Idle, but visually the character plays yet another cycle of Crouch before actually switching.
I tested the same with a one-time Attack animation and got the same issue, except when the Attack animation is already over when I switch back to Stand/Idle. It also allowed me to see that Attack plays at an abnormal slow speed when that happens, as if it was mimicking the speed of the Idle animation (AnimationPlayer doesn't have a concept of speed, only keyframes, so I suspect it's more that it's changing sprite frames at around the same pacing, except the AnimatedSprite2D Animation is not properly updated).
The issue looks some some kind of bad blending between the old and new animation where we keep the old AnimatedSprite2D Animation but somewhat still uses the new animations frame number.
To simplify, I removed transition conditions and the Crouch node, so we just have an Attack node that immediately switches back to the sub-state machine node when it can. So basically when clicking on that node, we should never see the Attack animation, but we do see a slow one.
The duplicate Attack node below connected to nothing is just to demonstrate a normal, fast Attack animation. But even this one is not reliable, sometimes when you click, it doesn't play or plays slowly.
Below, I demonstrate the Attack animation once directly from the AnimationPlayer, then I test the AnimationTree, and play the Attack animation one last time from the isolated node.
Finally, the animation played in the sub-state machine is not always Idle, the one pointed by the sub-machine Start node. If you test-ran sub-node Run first, then Attack will transition to that one, not respecting sub-machine Start. In my real game it's okay because there is an instant transition between Idle and Run, but in some cases you may want the character to always enter from Start.
Steps to reproduce
Open minimal repro project in the demo scene with the animated Slime
You can test some animations in the Animation Player directly to observe the speed of Idle and Attack in particular. Make sure to stop preview at the end to avoid conflict with the Animation Tree.
Select the Animation Tree and click play button on the Attack node connected to the sub-state machine. Repeat several times observing the slime => sometimes you'll see no Attack (correct), sometimes a very slow one (incorrect). If the animation is not slow, just repeated, try again after preview playing StateMachine > Idle to make sure it gets priority.
You can try to play other animation nodes to compare.
Bonus: Play StateMachine / Run node and repeat 3: note how Attack transitions into Run this time, although StateMachine Start connects to Idle
Godot version
v4.0.rc2.official [d2699dc]
System information
Linux Ubuntu 20.04 with Unity desktop
Issue description
I'm trying an Animation Tree mixing simple animation nodes and sub-state machine nodes:
I have a transition from Stand to Crouch and Crouch to Stand (the top-level node, but could also be with Stand/Idle), with an expression condition. When the condition is true, I switch from Stand/Idle to Crouch immediately, as expected. When the condition is false, I go back to Stand/Idle, but visually the character plays yet another cycle of Crouch before actually switching.
I tested the same with a one-time Attack animation and got the same issue, except when the Attack animation is already over when I switch back to Stand/Idle. It also allowed me to see that Attack plays at an abnormal slow speed when that happens, as if it was mimicking the speed of the Idle animation (AnimationPlayer doesn't have a concept of speed, only keyframes, so I suspect it's more that it's changing sprite frames at around the same pacing, except the AnimatedSprite2D Animation is not properly updated).
The issue looks some some kind of bad blending between the old and new animation where we keep the old AnimatedSprite2D Animation but somewhat still uses the new animations frame number.
To simplify, I removed transition conditions and the Crouch node, so we just have an Attack node that immediately switches back to the sub-state machine node when it can. So basically when clicking on that node, we should never see the Attack animation, but we do see a slow one.
The duplicate Attack node below connected to nothing is just to demonstrate a normal, fast Attack animation. But even this one is not reliable, sometimes when you click, it doesn't play or plays slowly.
Below, I demonstrate the Attack animation once directly from the AnimationPlayer, then I test the AnimationTree, and play the Attack animation one last time from the isolated node.
Pixel Slime by rvros (CC0 1.0)
Finally, the animation played in the sub-state machine is not always Idle, the one pointed by the sub-machine Start node. If you test-ran sub-node Run first, then Attack will transition to that one, not respecting sub-machine Start. In my real game it's okay because there is an instant transition between Idle and Run, but in some cases you may want the character to always enter from Start.
Steps to reproduce
Minimal reproduction project
v4.0.rc2 - AnimationTree transition to sub-state machine with much slower animation repeats last animation slowly.zip
The text was updated successfully, but these errors were encountered: