Code: Select all
$Camera3D.rotation.x = clamp($Camera3D.rotation.x, deg_to_rad(-75), deg_to_rad(75))
Code: Select all
func apply_controller_rotation():
if (keyb):
var axis_vector = Vector2.ZERO
axis_vector.x = Input.get_action_strength("look_right") - Input.get_action_strength("look_left")
axis_vector.y = Input.get_action_strength("look_down") - Input.get_action_strength("look_up")
axis_vector = axis_vector.normalized()
if axis_vector.length():
if InputEventJoypadMotion:
rotate_y(deg_to_rad(-axis_vector.x) * controller_sensitivity)
$Camera3D.rotate_x(deg_to_rad(-axis_vector.y) * controller_sensitivity)
$Camera3D.rotation.x = clamp($Camera3D.rotation.x, deg_to_rad(-75), deg_to_rad(75))
Link to Tutorial....