I am quite new to Godot and now, i have a little problem. I am using a code from youtube to help me build a first person camera system that follow the mouse cursor on where it goes, so if you turn right with the mouse the camera looks well, to the right. And ok, the camera is workin as expected with the X axis, but when looking down/up? No, it just simply don't work. The Y axis for some reason, even if in the videos that i follow the code it works perfectly, with me it doesn't. Here's the code for better understanding:
...
const mous_sens = 0.3
...
@onready var neck := $Neck
@onready var camera := $Neck/Camera3D
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _unhandled_input(event):
if event is InputEventMouseMotion:
neck.rotate_y(deg_to_rad(-event.relative.x * mous_sens))
camera.rotate_x(deg_to_rad(-event.relative.y * mous_sens))
camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-40), deg_to_rad(60))
Thanks to anyone that can help me with that! Any help is highly appreciated ๐