From 8c5cf8380353c1f2df7c1d6b02acf62038e0f458 Mon Sep 17 00:00:00 2001 From: teatov Date: Thu, 13 Feb 2025 19:12:47 +1000 Subject: [PATCH] add ability to move camera slower on controller --- project.godot | 5 +++++ scripts/player.gd | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/project.godot b/project.godot index 40c69a4..90185c0 100644 --- a/project.godot +++ b/project.godot @@ -141,6 +141,11 @@ run={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":true,"script":null) ] } +look_slow={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":8,"pressure":0.0,"pressed":true,"script":null) +] +} [layer_names] diff --git a/scripts/player.gd b/scripts/player.gd index aa18bcd..e3964fe 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -99,20 +99,24 @@ func _process_controller_rotating(delta: float) -> void: ) ) + var look_slow: float = 0.25 if Input.is_action_pressed("look_slow") else 1.0 + rotate_y( ( -controller_raw_input.x * deg_to_rad(Settings.controller_sensitivity_horizontal) + * look_slow * delta - * (-1 if Settings.invert_controller_horizontal else 1) + * (-1.0 if Settings.invert_controller_horizontal else 1.0) ) ) _camera.rotate_x( ( -controller_raw_input.y * deg_to_rad(Settings.controller_sensitivity_vertical) + * look_slow * delta - * (-1 if Settings.invert_controller_vertical else 1) + * (-1.0 if Settings.invert_controller_vertical else 1.0) ) ) _camera.rotation.x = clampf(_camera.rotation.x, PI / -2, PI / 2)