-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix for short animation blend taking too long when played during a long animation blend. #37001
Conversation
This sounds like it fixes what i reported #43570 . Does it? |
Should fix the second part, when calling the animation player directly. I'm not sure if the animation tree uses the same code path. |
@jitspoe This needs a rebase so it's testable @TokageItLab Can you take a look? |
@fire I don't use StateMachine often, so I don't really understand the original bug. I need a sample project with clear examples of bugs and fixes. I created a project file to try it out, but it doesn't seem to be like this. |
Your project unfortunately also shows a different bug; if the state transition is inside a BlendTree it skips to the animation end of the first state input when transitioning back instead of continuing from the current intermediate position. |
@Flavelius Thanks for the project file. As it turns out, the issue in #43570 does not seem to be related to this PR. The #43570 issue seems to be probably a bug only in the transition back to the start state. |
I'm digging through open PRs, and I'm confused what this PR is fixing. The linked issue #43570 is now closed. So my question is: what exactly does this change fix? |
This is a bug. For an extreme example: Using an AnimationPlayer on a 3D skeletal mesh, play Animation A. The linked issue had multiple things, and this only addressed a small part of one of them. |
@jitspoe are you ok checking if this is still valid in Godot Engine master? Also nudged @TokageItLab. |
I'll try to find time to test it. Lots of stuff happening at the moment. 😅 |
@fire Ok, blending from a blend is definitely broken in Godot 4 (as of beta 9). Here's a simple project: Here's the sample project code for reference:
Note that if you change the first timer to go directly to start_anim3, the end result is what's expected. The arm will start rotating forward, then blend to rotating back. If you do all 3 blends, it starts correctly, blending slowly into the sidways up anim, but when it gets to the 3rd anim, it pops and the end result is the arm in the up forward position instead of up back. Edit: Seems this behavior did change slightly, and looking at the code it seems there were some attempts to fix, but they are still not correct for blending with a long blend that exceeds the anim time. This PR is still relevant. |
I have been working on various animation bug fixes lately and I just realized that this is a problem with AnimationPlayer's Blending feature. Yes, AnimationPlayer's Blending is almost completely broken and has already come to the point where it is impossible to fix. See godotengine/godot-proposals#5952 and #70241 for a detail of the problem. |
3d17b43
to
14cf5e5
Compare
I've done a rebase, so this should be compatible with the latest 4.x, now. Hopefully I didn't mess anything up. Spent like 2 hours dealing with mystery parts of code and commits appearing/disappearing. |
14cf5e5
to
a4e16ba
Compare
93c4383
to
9d9a57b
Compare
… played immediately after an animation with a long blend time would play with a long blend time or cause popping/incorrect animation positions.
9d9a57b
to
7a7f5a2
Compare
Thanks! |
Would be great to get this backported to 3.x (what the PR was originally for) as well! |
If you play an animation with a long blend time and, while that blend is still happening, play one with a short (or zero) blend time, the long blend time will continue to be used (logic was sort of reversed). Also, if you played an animation with a 0 blend time while a blend was active, it still tried to blend. This PR fixes those issues.