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

Animation in BlendSpace1D only plays the first frame of animation #74706

Closed
derkork opened this issue Mar 10, 2023 · 8 comments
Closed

Animation in BlendSpace1D only plays the first frame of animation #74706

derkork opened this issue Mar 10, 2023 · 8 comments

Comments

@derkork
Copy link

derkork commented Mar 10, 2023

Godot version

v4.0.stable.official [92bee43]

System information

Windows 10, OSX 12.6.1

Issue description

I have two animations ("idle_left" and "idle_right") which are playing fine in the AnimationPlayer.

2023-03-10_09-33-49.mp4

When I use these animations in a BlendSpace1D in an AnimationTree, only the first frame of each animation seems to be played:

2023-03-10_09-36-43.mp4

Steps to reproduce

I have just added two animations to the AnimationPlayer. Then in the AnimationTree I added a state machine as root and added a BlendSpace1D node to blend both animations. Then on the left side i added the "idle_left" animation and on the right side I added the "idle_right" animation.

Minimal reproduction project

animation_reproducer.zip

@kleonc
Copy link
Member

kleonc commented Mar 14, 2023

  • The issue seems to be a mismatch of the update mode (discrete vs continous) for the frame track between the RESET and the other animations.
  • Another issue is in the RESET animation hframes is not set properly (it's 1) which leads to errors after fixing the issue in the point up above (like Index p_frame = 9 is out of bounds (vframes * hframes = 1).). Setting it to 11 within the RESET animation as in the other animaitons make these go away.

So everything seems to be working correctly, when it's being setup accordingly.

@TokageItLab The question is whether all this is intended/expected behavior, or whether it's a bug. If it is a correct behavior, then the issue in here is that it's not anyhow indicated to the user what's the issue with the original setup. No error, no warning, nothing.

@derkork
Copy link
Author

derkork commented Mar 15, 2023

Thanks a lot for digging into this and telling me. I would probably not have found this in a million years. For me the editor now shows a warning about the mismatch of the update mode (i'm not sure if this is new or if I just missed it the first time around). As for other warnings, I'm not sure what kind of warning the editor could give as this would require the editor to sort of guess the user's intention.

Could you maybe give some details into how you approached fixing this? Maybe a small "when your animation doesn't work in BlendSpace"-checklist could be made out of this, that I could add to the tutorial for the animation tree.

@TokageItLab
Copy link
Member

An error should be notified if the update mode is mismatched, but the user may miss it if there are many other notifications. Well, it would be nice to add a troubleshooting section on animation to the documentation.

@derkork
Copy link
Author

derkork commented Mar 15, 2023

If you can suggest a few steps I'll happily add it to the documentation 👍

@kleonc
Copy link
Member

kleonc commented Mar 15, 2023

For me the editor now shows a warning about the mismatch of the update mode (i'm not sure if this is new or if I just missed it the first time around). As for other warnings, I'm not sure what kind of warning the editor could give as this would require the editor to sort of guess the user's intention.

Could you maybe give some details into how you approached fixing this?

@derkork Well, I've actually seen the warning about the mismatched update modes some other time before when testing / playing with the AnimationTree. So I remembered it could be an issue, hence that's what I've checked. But within the provided MRP I still can't make such warning to show up. Nothing right after opening, nothing after trying to tweak many different settings. Just tried to trigger this warning for like 5 minutes. No luck.


An error should be notified if the update mode is mismatched, but the user may miss it if there are many other notifications.

@TokageItLab As I wrote up above, I've seen such warning earlier but not in the MRP provided in here. It's not like I've missed it, it just never shown up for me in here (I try to check the warnings before clearing them, especially when testing an issue).


Maybe a small "when your animation doesn't work in BlendSpace"-checklist could be made out of this, that I could add to the tutorial for the animation tree.

Well, it would be nice to add a troubleshooting section on animation to the documentation.

If you can suggest a few steps I'll happily add it to the documentation +1

Sure it would be nice to have such section. Myself I'm not aware of all the AnimationTree's quirks / expectations etc.
Of course it would be nice if as much info/warnings could be directly provided to the user within the editor.

@kleonc
Copy link
Member

kleonc commented Mar 15, 2023

After looking at the source code:

} else if (track_cache_type == Animation::TYPE_VALUE) {
// If it has at least one angle interpolation, it also uses angle interpolation for blending.
TrackCacheValue *track_value = static_cast<TrackCacheValue *>(track);
bool was_discrete = track_value->is_discrete;
bool was_using_angle = track_value->is_using_angle;
track_value->is_discrete |= anim->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE;
track_value->is_using_angle |= anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_LINEAR_ANGLE || anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_CUBIC_ANGLE;
if (was_discrete != track_value->is_discrete) {
ERR_PRINT_ED("Value track: " + String(path) + " with different update modes are blended. Blending prioritizes Discrete mode, so other update mode tracks will not be blended.");
}
if (was_using_angle != track_value->is_using_angle) {
WARN_PRINT_ED("Value track: " + String(path) + " with different interpolation types for rotation are blended. Blending prioritizes angle interpolation, so the blending result uses the shortest path referenced to the initial (RESET animation) value.");
}
}

I was able to trigger the error (Value track: Sprite2D:frame with different update modes are blended. Blending prioritizes Discrete mode, so other update mode tracks will not be blended.) pretty much immediately: it's shown only when the new track (being blended in I suppose) is discrete and the previous one was not. The other way around it's not triggered.

Meaning for update modes:

  • In RESET discrete, in the other animation continuous: the error is not trigerred (like in the MRP).
  • In RESET continuous, in the other animation discrete: the error is trigerred.

@TokageItLab
Copy link
Member

Oh sure, I may be flagging it wrong. I'll take a look at it later.

@TokageItLab
Copy link
Member

Closed by #86629

@github-project-automation github-project-automation bot moved this from To Assess to Done in 4.x Priority Issues Jul 9, 2024
@TokageItLab TokageItLab added this to the 4.3 milestone Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants