Fixup #25
Make the PR code more readable and match the style of the codebase
This commit is contained in:
@ -22,8 +22,8 @@ extends CharacterBody3D
|
|||||||
@export var jump_velocity : float = 4.5
|
@export var jump_velocity : float = 4.5
|
||||||
## How far the player turns when the mouse is moved.
|
## How far the player turns when the mouse is moved.
|
||||||
@export var mouse_sensitivity : float = 0.1
|
@export var mouse_sensitivity : float = 0.1
|
||||||
## Mouse/joystick invert y
|
## Invert the Y input for mouse and joystick
|
||||||
@export var invert_pitch_control := false
|
@export var invert_mouse_y : bool = false
|
||||||
## Wether the player can use movement inputs. Does not stop outside forces or jumping. See Jumping Enabled.
|
## Wether the player can use movement inputs. Does not stop outside forces or jumping. See Jumping Enabled.
|
||||||
@export var immobile : bool = false
|
@export var immobile : bool = false
|
||||||
## The reticle file to import at runtime. By default are in res://addons/fpc/reticles/. Set to an empty string to remove.
|
## The reticle file to import at runtime. By default are in res://addons/fpc/reticles/. Set to an empty string to remove.
|
||||||
@ -241,12 +241,19 @@ func handle_movement(delta, input_dir):
|
|||||||
|
|
||||||
func handle_head_rotation():
|
func handle_head_rotation():
|
||||||
HEAD.rotation_degrees.y -= mouseInput.x * mouse_sensitivity
|
HEAD.rotation_degrees.y -= mouseInput.x * mouse_sensitivity
|
||||||
HEAD.rotation_degrees.x -= mouseInput.y * mouse_sensitivity * (-1.0 if invert_pitch_control else 1.0)
|
if invert_mouse_y:
|
||||||
|
HEAD.rotation_degrees.x -= mouseInput.y * mouse_sensitivity * -1.0
|
||||||
|
else:
|
||||||
|
HEAD.rotation_degrees.x -= mouseInput.y * mouse_sensitivity
|
||||||
|
|
||||||
# Uncomment for controller support
|
# Uncomment for controller support
|
||||||
#var controller_view_rotation = Input.get_vector(LOOK_DOWN, LOOK_UP, LOOK_RIGHT, LOOK_LEFT) * controller_sensitivity # These are inverted because of the nature of 3D rotation.
|
#var controller_view_rotation = Input.get_vector(LOOK_DOWN, LOOK_UP, LOOK_RIGHT, LOOK_LEFT) * controller_sensitivity # These are inverted because of the nature of 3D rotation.
|
||||||
#HEAD.rotation.x += controller_view_rotation.x
|
#HEAD.rotation.x += controller_view_rotation.x
|
||||||
#HEAD.rotation.y += controller_view_rotation.y * (-1.0 if invert_pitch_control else 1.0)
|
#if invert_mouse_y:
|
||||||
|
#HEAD.rotation.y += controller_view_rotation.y * -1.0
|
||||||
|
#else:
|
||||||
|
#HEAD.rotation.y += controller_view_rotation.y
|
||||||
|
|
||||||
|
|
||||||
mouseInput = Vector2(0,0)
|
mouseInput = Vector2(0,0)
|
||||||
HEAD.rotation.x = clamp(HEAD.rotation.x, deg_to_rad(-90), deg_to_rad(90))
|
HEAD.rotation.x = clamp(HEAD.rotation.x, deg_to_rad(-90), deg_to_rad(90))
|
||||||
|
Reference in New Issue
Block a user