diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 0bc0b1cb85..c5a1e2878b 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -611,7 +611,11 @@ impl Hud { } // Crosshair let show_crosshair = (info.is_aiming || info.is_first_person) && !stats.is_dead; - self.crosshair_opacity = Lerp::lerp(self.crosshair_opacity, if show_crosshair { 1.0 } else { 0.0 }, 5.0 * dt.as_secs_f32()); + self.crosshair_opacity = Lerp::lerp( + self.crosshair_opacity, + if show_crosshair { 1.0 } else { 0.0 }, + 5.0 * dt.as_secs_f32(), + ); if !self.show.help { Image::new( diff --git a/voxygen/src/scene/camera.rs b/voxygen/src/scene/camera.rs index 887e50b015..451e60c7cb 100644 --- a/voxygen/src/scene/camera.rs +++ b/voxygen/src/scene/camera.rs @@ -185,10 +185,10 @@ impl Camera { } } - /// Get the distance of the camera from the target + /// Get the distance of the camera from the focus pub fn get_distance(&self) -> f32 { self.dist } - /// Set the distance of the camera from the target (i.e., zoom). + /// Set the distance of the camera from the focus (i.e., zoom). pub fn set_distance(&mut self, dist: f32) { self.tgt_dist = dist; } pub fn update(&mut self, time: f64, dt: f32, smoothing_enabled: bool) { @@ -206,11 +206,12 @@ impl Camera { let lerped_focus = Lerp::lerp( self.focus, self.tgt_focus, - (delta as f32) / self.interp_time() * if matches!(self.mode, CameraMode::FirstPerson) { - 2.0 - } else { - 1.0 - }, + (delta as f32) / self.interp_time() + * if matches!(self.mode, CameraMode::FirstPerson) { + 2.0 + } else { + 1.0 + }, ); // Snap when close enough in x/y, but lerp otherwise @@ -298,8 +299,8 @@ impl Camera { /// Get the mode of the camera pub fn get_mode(&self) -> CameraMode { - // Perfom a bit of a trick... don't report first-person until the camera has lerped close - // enough to the player. + // Perfom a bit of a trick... don't report first-person until the camera has + // lerped close enough to the player. match self.mode { CameraMode::FirstPerson if self.dist < 0.5 => CameraMode::FirstPerson, CameraMode::FirstPerson => CameraMode::ThirdPerson, diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index f2929019e0..a7b2766a57 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -239,9 +239,8 @@ impl Scene { CameraMode::ThirdPerson => 1.65, }; - self.camera.set_focus_pos( - player_pos + Vec3::unit_z() * (up - tilt.min(0.0).sin() * dist * 0.6), - ); + self.camera + .set_focus_pos(player_pos + Vec3::unit_z() * (up - tilt.min(0.0).sin() * dist * 0.6)); // Tick camera for interpolation. self.camera.update( diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index aefc8d265e..fd39a92d90 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -522,7 +522,10 @@ impl PlayState for SessionState { .unwrap_or(false); aimed }, - is_first_person: matches!(self.scene.camera().get_mode(), camera::CameraMode::FirstPerson), + is_first_person: matches!( + self.scene.camera().get_mode(), + camera::CameraMode::FirstPerson + ), }, );