From b751a507bd9a50e53fa75be39d9e01858c1b5ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Korg=C3=B3l?= <kpiotr2005@gmail.com> Date: Tue, 23 Jul 2019 21:40:56 +0200 Subject: [PATCH] Zoom out the camera when entering third person mode --- voxygen/src/scene/camera.rs | 5 ++++- voxygen/src/session.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/voxygen/src/scene/camera.rs b/voxygen/src/scene/camera.rs index 1bd759a2bb..32daf49a6d 100644 --- a/voxygen/src/scene/camera.rs +++ b/voxygen/src/scene/camera.rs @@ -116,7 +116,7 @@ impl Camera { pub fn zoom_by(&mut self, delta: f32) { if self.can_zoom { // Clamp camera dist to the 0 <= x <= infinity range - self.tgt_dist = (self.tgt_dist + delta).max(0.0); + self.tgt_dist = (self.tgt_dist + delta).max(2.0); } } @@ -176,6 +176,9 @@ impl Camera { match self.mode { CameraMode::ThirdPerson => { self.can_zoom = true; + if self.tgt_dist == 0.0 { + self.zoom_by(5.0); + } }, CameraMode::FirstPerson => { self.set_distance(0.0); diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index 445626f347..6d22c499e4 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -134,7 +134,7 @@ impl PlayState for SessionState { if b { let pos = (cam_pos + cam_dir * (d - 0.01)).map(|e| e.floor() as i32); - client.place_block(pos, self.selected_block); // TODO: Handle block color with a command + client.place_block(pos, self.selected_block); } } else { self.controller.attack = state