From bf915012ff81702cc3171b617df0499241c93ebc Mon Sep 17 00:00:00 2001 From: Greeble <166992735+greeble-dev@users.noreply.github.com> Date: Thu, 27 Mar 2025 21:33:25 +0000 Subject: [PATCH] Fix animation transitions affecting other entities (#18572) ## Objective Fix #18557. ## Solution As described in the bug, `remaining_weight` should have been inside the loop. ## Testing Locally changed the `animated_mesh_control` example to spawn multiple meshes and play different transitions. --- crates/bevy_animation/src/transition.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bevy_animation/src/transition.rs b/crates/bevy_animation/src/transition.rs index b287c1f2a9..4948559704 100644 --- a/crates/bevy_animation/src/transition.rs +++ b/crates/bevy_animation/src/transition.rs @@ -118,8 +118,9 @@ pub fn advance_transitions( // is divided between all the other layers, eventually culminating in the // currently-playing animation receiving whatever's left. This results in a // nicely normalized weight. - let mut remaining_weight = 1.0; for (mut animation_transitions, mut player) in query.iter_mut() { + let mut remaining_weight = 1.0; + for transition in &mut animation_transitions.transitions.iter_mut().rev() { // Decrease weight. transition.current_weight = (transition.current_weight