From a14e2950079b4b723dfb00819cee882e05e56e97 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 18 Apr 2024 22:48:21 +0200 Subject: [PATCH] tweak map parameters --- src/camera.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 036fea1..468e4de 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -40,9 +40,9 @@ pub struct MapCam { impl Default for MapCam { fn default() -> Self { Self { - zoom_level: 1000.0, + zoom_level: 10.0, target_zoom_level: 10000.0, - pitch: 0.0, + pitch: PI * 0.3, yaw: 0.0, } } @@ -132,7 +132,7 @@ pub fn update_map_camera( // NOTE: we need to subtract a bit from PI/2, otherwise the "up" // direction parameter for the Transform.look_at function is ambiguous // at the extreme values and the orientation will flicker back/forth. - let epsilon = 0.000001; + let epsilon = 0.001; mapcam.pitch = (mapcam.pitch + mouse_delta.y / 180.0 * settings.mouse_sensitivity).clamp(-PI / 2.0 + epsilon, PI / 2.0 - epsilon); mapcam.yaw += mouse_delta.x / 180.0 * settings.mouse_sensitivity; @@ -143,7 +143,8 @@ pub fn update_map_camera( if keyboard_input.pressed(settings.key_map_zoom_in) { mapcam.target_zoom_level /= 1.1; } - mapcam.zoom_level = 0.1 * mapcam.target_zoom_level + 0.9 * mapcam.zoom_level; + let zoom_speed = 0.05; // should be between 0.0001 (slow) and 1.0 (instant) + mapcam.zoom_level = zoom_speed * mapcam.target_zoom_level + (1.0 - zoom_speed) * mapcam.zoom_level; // Update point of view let pov_rotation = Quat::from_euler(EulerRot::XYZ, 0.0, mapcam.yaw, mapcam.pitch);