extends Node3D

@export var vertical_joystick_sensitity : float = 2
@export var vertical_mouse_sensitivity : float = 0.02

func can_look(amount, sensitivity):
		var current_rotation_x = global_rotation_degrees.x
		var amount_to_move = amount * vertical_mouse_sensitivity
		var angle_after_move = current_rotation_x + amount_to_move
		if angle_after_move >= -85 and angle_after_move <= 85:
			return true
		else:
			false

func _process(delta):
	var look_velocity = Input.get_vector("look_left", "look_right", "look_up", "look_down")
	rotate_x(-look_velocity.y * vertical_joystick_sensitity * delta)

func _unhandled_input(event):
	if event is InputEventMouseMotion:
		var rotate_amount = -event.relative.y * vertical_mouse_sensitivity 
		self.rotate_x(rotate_amount)
		
