Fix mouse look movement

Weird things happened
This commit is contained in:
karl 2019-11-21 10:33:26 +01:00
parent ecfba2d7f3
commit d32c0f485b

View File

@ -146,10 +146,8 @@ func check_interact():
func _input(event):
# capture mouse movement
if event is InputEventMouseMotion:
_body.rotate_x(deg2rad(event.relative.y * MOUSE_SENSITIVITY * -1))
_camera.rotate_x(deg2rad(event.relative.y * MOUSE_SENSITIVITY * -1))
self.rotate_y(deg2rad(event.relative.x * MOUSE_SENSITIVITY * -1))
var camera_rot = _body.rotation_degrees
camera_rot.x = clamp(camera_rot.x, -70, 70)
_body.rotation_degrees = camera_rot
# interact with object player is looking at
# Prevent player from doing a purzelbaum
_camera.rotation_degrees.x = clamp(_camera.rotation_degrees.x, -70, 70)