From 66884f67448e1909ddad2216615308388b3f0947 Mon Sep 17 00:00:00 2001 From: SputerSnoot Date: Sat, 9 Aug 2025 05:23:39 +0300 Subject: [PATCH] Added Q - move down, E - move up --- README.md | 2 +- addons/sk_fly_camera/src/fly_camera.gd | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 363c1de..0db4667 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A camera addon for flying around scenes at runtime, which can be handy during th The camera is easy to use. You can just drop it in a scene, and run the game. Optionally you can also tweek the camera node settings in the inspector (speed, mouse sensitivity, etc). -By default the camera uses `WASD` keys for movement, `Shift` to move faster, `Ctrl` to move slower, +By default the camera uses `WASD` keys for movement, `Q` to move down, `E` to move up, `Shift` to move faster, `Ctrl` to move slower, and `Right Mouse Button` to activate/deactivate the camera's mouse controls. Please refer to the documentation for more information. diff --git a/addons/sk_fly_camera/src/fly_camera.gd b/addons/sk_fly_camera/src/fly_camera.gd index 6bf122b..c24c611 100644 --- a/addons/sk_fly_camera/src/fly_camera.gd +++ b/addons/sk_fly_camera/src/fly_camera.gd @@ -28,7 +28,8 @@ extends CharacterBody3D ## [br][br] ## ## The camera controls can be changed. By default it uses the [param WASD] -## keys for movement, [param Shift] to move faster, [param Ctrl] to move slower, and +## keys for movement, [param Q] to move down, [param E] to move up, +## [param Shift] to move faster, [param Ctrl] to move slower, and ## the [param Right Mouse Button] to activate/deactivate the mouse controls ## (capturing/uncapturing the mouse pointer). ## [br][br] @@ -42,6 +43,8 @@ extends CharacterBody3D ##cam_backward ##cam_left ##cam_right +##cam_up +##cam_down ##cam_faster ##cam_slower ##cam_activate @@ -141,6 +144,8 @@ const _ACTION_FORWARD := "cam_forward" const _ACTION_BACKWARD := "cam_backward" const _ACTION_LEFT := "cam_left" const _ACTION_RIGHT := "cam_right" +const _ACTION_UP := "cam_up" +const _ACTION_DOWN := "cam_down" const _ACTION_FASTER := "cam_faster" const _ACTION_SLOWER := "cam_slower" const _ACTION_ACTIVATE := "cam_activate" @@ -150,6 +155,8 @@ var _actions_to_key := { _ACTION_BACKWARD : KEY_S, _ACTION_LEFT : KEY_A, _ACTION_RIGHT : KEY_D, + _ACTION_UP : KEY_E, + _ACTION_DOWN : KEY_Q, _ACTION_FASTER : KEY_SHIFT, _ACTION_SLOWER : KEY_CTRL, _ACTION_ACTIVATE : mouse_button, @@ -212,6 +219,8 @@ func _physics_process(delta: float) -> void: if _is_cam_action_pressed(_ACTION_BACKWARD): dir += aim[2] if _is_cam_action_pressed(_ACTION_LEFT): dir -= aim[0] if _is_cam_action_pressed(_ACTION_RIGHT): dir += aim[0] + if _is_cam_action_pressed(_ACTION_UP): dir += aim[1] + if _is_cam_action_pressed(_ACTION_DOWN): dir -= aim[1] if _is_cam_action_pressed(_ACTION_FASTER): spd *= speed_factor if _is_cam_action_pressed(_ACTION_SLOWER): spd /= speed_factor