#App Touchscreen Cam Rotation ...
2 messages · Page 1 of 1 (latest)
func _input(event) -> void:
if event is InputEventMouseMotion:
rotation.y -= event.relative.x * horizontalSensitivity
rotation.y = wrapf(rotation.y,0.0,TAU)
rotation.x -= event.relative.y * verticalSensitivity
rotation.x = clamp(rotation.x, deg2rad(minPitchDeg), deg2rad(maxPitchDeg))
elif Input.is_action_pressed("left"):
rotate_y(0.1)
rotation.y = wrapf(rotation.y,0.0,TAU)
elif Input.is_action_pressed("right"):
rotate_y(-0.1)
rotation.y = wrapf(rotation.y,0.0,TAU)
elif Input.is_action_pressed("up"):
rotate_x(0.1)
rotation.x = clamp(rotation.x, deg2rad(minPitchDeg), deg2rad(maxPitchDeg))
elif Input.is_action_pressed("down"):
rotate_x(-0.1)
rotation.x = clamp(rotation.x, deg2rad(minPitchDeg), deg2rad(maxPitchDeg))