Godot Version
4.3
Question
Hello!
I’m trying to rotate a 3d first person camera with the keyboard (like in old 3d games).
but when I test it there is always a delay when pressing the keys and when several keys are played at the same time.
I can’t use internet solutions because all of them are for mouse, and i need to move the camera with the keyboard.
Can someone tell me how to do it?
Thank you.
@onready var camarapivot: Node3D = $camarapivot
var sencibilidad = 0.05
func _input(delta):
if Input.is_action_pressed("ui_left"):
rotate_y(sencibilidad)
if Input.is_action_pressed("ui_right"):
rotate_y(-sencibilidad)
if Input.is_action_pressed("ui_up"):
camarapivot.rotate_x(sencibilidad)
if Input.is_action_pressed("ui_down"):
camarapivot.rotate_x(-sencibilidad)
camarapivot.rotation.x = clampf(camarapivot.rotation.x, -deg_to_rad(80), deg_to_rad(80))