From 44c3cfa0d9eb6d6970b6bc3829a6a3f308581f50 Mon Sep 17 00:00:00 2001 From: Simon Ward Date: Thu, 22 Jan 2026 17:41:39 +1300 Subject: [PATCH 1/3] player: clamp camera rotation --- player/camera_gimbal.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/player/camera_gimbal.gd b/player/camera_gimbal.gd index e3d74a2..f28d77f 100644 --- a/player/camera_gimbal.gd +++ b/player/camera_gimbal.gd @@ -1,6 +1,8 @@ class_name CameraGimbal extends Node3D @export var rotation_speed = (PI / 180) * 120 +@onready var Camera = $InnerGimbal/Camera3D + func reset(): basis = Basis() @@ -9,10 +11,13 @@ func reset(): func rotate_camera_y(y, delta): rotate_object_local(Vector3.UP, y * rotation_speed * delta) func rotate_camera_x(x, delta): + $InnerGimbal.rotate_object_local( Vector3.RIGHT, x * rotation_speed * delta) - + $InnerGimbal.rotation.x = clamp($InnerGimbal.rotation.x,-0.8,0.7) + func _process(delta): + # rotate outer gimbal around y axis var y = 0 if Input.is_action_pressed("cam_left"): From 3a635e955161092442532c2de420d035a5e6c6ff Mon Sep 17 00:00:00 2001 From: Simon Ward Date: Thu, 22 Jan 2026 17:51:31 +1300 Subject: [PATCH 2/3] player: removed empty lines --- player/camera_gimbal.gd | 4 ---- 1 file changed, 4 deletions(-) diff --git a/player/camera_gimbal.gd b/player/camera_gimbal.gd index f28d77f..035053e 100644 --- a/player/camera_gimbal.gd +++ b/player/camera_gimbal.gd @@ -1,8 +1,6 @@ class_name CameraGimbal extends Node3D @export var rotation_speed = (PI / 180) * 120 -@onready var Camera = $InnerGimbal/Camera3D - func reset(): basis = Basis() @@ -11,13 +9,11 @@ func reset(): func rotate_camera_y(y, delta): rotate_object_local(Vector3.UP, y * rotation_speed * delta) func rotate_camera_x(x, delta): - $InnerGimbal.rotate_object_local( Vector3.RIGHT, x * rotation_speed * delta) $InnerGimbal.rotation.x = clamp($InnerGimbal.rotation.x,-0.8,0.7) func _process(delta): - # rotate outer gimbal around y axis var y = 0 if Input.is_action_pressed("cam_left"): From 545102a13954588c25bcc09f7cd5f81ac735e95e Mon Sep 17 00:00:00 2001 From: Simon Ward Date: Thu, 22 Jan 2026 17:41:39 +1300 Subject: [PATCH 3/3] player: clamp camera rotation --- player/camera_gimbal.gd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/player/camera_gimbal.gd b/player/camera_gimbal.gd index e3d74a2..035053e 100644 --- a/player/camera_gimbal.gd +++ b/player/camera_gimbal.gd @@ -11,7 +11,8 @@ func rotate_camera_y(y, delta): func rotate_camera_x(x, delta): $InnerGimbal.rotate_object_local( Vector3.RIGHT, x * rotation_speed * delta) - + $InnerGimbal.rotation.x = clamp($InnerGimbal.rotation.x,-0.8,0.7) + func _process(delta): # rotate outer gimbal around y axis var y = 0