diff --git a/src/navigation.rs b/src/navigation.rs index 8f6d084..c4167bb 100644 --- a/src/navigation.rs +++ b/src/navigation.rs @@ -99,7 +99,6 @@ impl Default for Speed { } fn snap( - mut tts: ResMut, mut snap_timers: ResMut, mut query: Query< ( @@ -110,7 +109,7 @@ fn snap( ), With, >, -) -> Result<(), Box> { +) { for (entity, actions, mut transform, direction) in &mut query { if snap_timers.contains_key(&entity) { continue; @@ -138,11 +137,12 @@ fn snap( let yaw: Rot2 = direction.into(); let yaw = yaw.as_radians(); println!("Yaw: {yaw}"); - transform.rotation = Quat::from_rotation_z(yaw); - tts.speak(direction.to_string(), true)?; + let rotation = Quat::from_rotation_z(yaw); + if transform.rotation != rotation { + transform.rotation = rotation; + } } } - Ok(()) } fn tick_snap_timers(time: Res