-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Last keyframe of animation curve not sampled #10832
Comments
Judging by the code below ( |
If |
Because the keyframes are sampled two at a time ( But it does look like the final state after an animation has run would not be exactly equal to the last keyframe, which is pretty bad. (Assuming I've successfully grokked the code here) |
We can just return the last Keyframe if Let t=last keyframe time, then |
Yeah, We should apply the last keyframe instead of continuing. |
My mistake. You were talking about the cases where t0 is before the last keyframe and t1 after and the case where t0 is before the keyframe before the last and t1 is after the last keyframe. I only considered the case t=clip duration. Currently, all those cases are not handled properly imo - but the first two cases are not trivial to solve |
I would scope this issue for t=clip duration, because thats an easy fix. To give an idea why the other cases are worthy a separate discussion: Lets consider two animations
Under the assumption that finished curves are not contributing to the final result aka we are not holding the last pose. If we implement that if the curve finished and the last keyframe was not sampled exactly that we apply the last keyframe, so that the animated object always has the same pose after the animation finished, then we have the following scenario: When we sample again at There may be other edge cases and I dont know the consensus about holding the last pose. edit: " |
# Objective While working on #10832, I found this code very dense and hard to understand. I was not confident in my fix (or the correctness of the existing code). ## Solution Clean up, test and document the code used in the `apply_animation` system. I also added a pair of length-related utility methods to `Keyframes` for easier testing. They seemed generically useful, so I made them pub. ## Changelog - Added `VariableCurve::find_current_keyframe` method. - Added `Keyframes::len` and `is_empty` methods. --------- Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
Bevy version
0.12
Bug
The current implementation for sampling the animation doesnt return the last keyframe of a curve.
bevy/crates/bevy_animation/src/lib.rs
Lines 681 to 685 in b4c33da
The text was updated successfully, but these errors were encountered: