tweak map parameters

This commit is contained in:
yuni 2024-04-18 22:48:21 +02:00
parent 463745eabb
commit a14e295007

View file

@ -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);