Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
11 changes: 10 additions & 1 deletion addons/sk_fly_camera/src/fly_camera.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -42,6 +43,8 @@ extends CharacterBody3D
##cam_backward
##cam_left
##cam_right
##cam_up
##cam_down
##cam_faster
##cam_slower
##cam_activate
Expand Down Expand Up @@ -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"
Expand All @@ -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,
Expand Down Expand Up @@ -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

Expand Down