From d575a8bcf86c5260bed2952347ff9a3bf9f56990 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 14 Jun 2020 02:11:02 +0200 Subject: [PATCH] separated mouselook function --- Player.gd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Player.gd b/Player.gd index a9791f8..9d2705f 100644 --- a/Player.gd +++ b/Player.gd @@ -4,7 +4,7 @@ const GRAVITY = 9.8 const JUMP_VELOCITY = 400 const WALK_VELOCITY = 550 -const MOUSE_SENSITIVITY = 1.0 / 30 +const MOUSE_SENSITIVITY = 1.0 / 300 onready var camera = $Camera @@ -34,6 +34,10 @@ remote func jump(): print("JUMP") velocity.y = JUMP_VELOCITY +remote func mouselook(rel): + self.rotate_y(- rel.x * MOUSE_SENSITIVITY) + camera.rotate_x(-rel.y * MOUSE_SENSITIVITY) + func motion(delta): self.move_and_slide(velocity * delta, Vector3.UP) @@ -51,9 +55,7 @@ func _input(event): # Moouselook if event is InputEventMouseMotion: var rel = event["relative"] - self.rotate_y(- rel.x * MOUSE_SENSITIVITY) - camera.rotate_x(rel.y * MOUSE_SENSITIVITY) - + mouselook(rel) # Jump if event.is_action_pressed("MoveJump"):