Fix mouse look movement
Weird things happened
This commit is contained in:
parent
ecfba2d7f3
commit
d32c0f485b
@ -146,10 +146,8 @@ func check_interact():
|
|||||||
func _input(event):
|
func _input(event):
|
||||||
# capture mouse movement
|
# capture mouse movement
|
||||||
if event is InputEventMouseMotion:
|
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))
|
self.rotate_y(deg2rad(event.relative.x * MOUSE_SENSITIVITY * -1))
|
||||||
|
|
||||||
var camera_rot = _body.rotation_degrees
|
# Prevent player from doing a purzelbaum
|
||||||
camera_rot.x = clamp(camera_rot.x, -70, 70)
|
_camera.rotation_degrees.x = clamp(_camera.rotation_degrees.x, -70, 70)
|
||||||
_body.rotation_degrees = camera_rot
|
|
||||||
# interact with object player is looking at
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user