add ability to move camera slower on controller

This commit is contained in:
Teatov 2025-02-13 19:12:47 +10:00
parent 0652e0d23b
commit 8c5cf83803
2 changed files with 11 additions and 2 deletions

View File

@ -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) , 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] [layer_names]

View File

@ -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( rotate_y(
( (
-controller_raw_input.x -controller_raw_input.x
* deg_to_rad(Settings.controller_sensitivity_horizontal) * deg_to_rad(Settings.controller_sensitivity_horizontal)
* look_slow
* delta * delta
* (-1 if Settings.invert_controller_horizontal else 1) * (-1.0 if Settings.invert_controller_horizontal else 1.0)
) )
) )
_camera.rotate_x( _camera.rotate_x(
( (
-controller_raw_input.y -controller_raw_input.y
* deg_to_rad(Settings.controller_sensitivity_vertical) * deg_to_rad(Settings.controller_sensitivity_vertical)
* look_slow
* delta * 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) _camera.rotation.x = clampf(_camera.rotation.x, PI / -2, PI / 2)