Skip to content

Commit 0d13444

Browse files
clear animation evaluator stack (#21118)
# Objective A large complex animation (2642 curves over 62 joints) causes serious residual noise on joints after it stops playing. here i start the animation then quickly cancel it: https://github.com/user-attachments/assets/9552d69e-bb10-400f-94a6-c93d301c689b this also seems to affect entities that are animated, but not by the player that fires the large animation, which is really bizarre (here i do not cancel it): https://github.com/user-attachments/assets/a0d99df5-f53d-4ff0-9cf1-87a0e78b8abd ## Solution debugging i found that the curve evaluator stack is growing unbounded while the complex animation is playing (100k items after a second or two) and is not cleared after the animation is stopped / replaced, so i tried clearing the evaluator stack and that seems to fix it. i have no idea if this fix is sensible or if the root of the issue is elsewhere. i don't see any knockon ill-effects but can't be sure there aren't any. i do not understand this code at all and it's hard to get a clear picture of what it's trying to do, so hopefully somebody who does understand it can diagnose better. i attached the gltf containing the animation that causes the issue but i can't give a simple repro - in my code i have to retarget the animation onto an avatar which isn't included in the animation gltf (i can provide an example for that if anybody wants it). [bafybeicoja22tkr2rxpccmwh74yehnurgolias77reztd2kuhtvsn2luue.glb.zip](https://github.com/user-attachments/files/22408365/bafybeicoja22tkr2rxpccmwh74yehnurgolias77reztd2kuhtvsn2luue.glb.zip) ## Testing no Co-authored-by: Alice Cecile <[email protected]>
1 parent d5dfab9 commit 0d13444

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

crates/bevy_animation/src/animation_curves.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ impl<A: Animatable> AnimationCurveEvaluator for AnimatableCurveEvaluator<A> {
416416
.pop()
417417
.ok_or_else(inconsistent::<AnimatableCurveEvaluator<A>>)?
418418
.value;
419+
self.evaluator.stack.clear();
419420
Ok(())
420421
}
421422
}

0 commit comments

Comments
 (0)