From 1ccc833b1a4e04dbd29ac3dd4112ed100459fc94 Mon Sep 17 00:00:00 2001 From: Rendo Date: Wed, 26 Nov 2025 19:32:53 +0500 Subject: [PATCH] Recoil overcompensation fix --- scenes/player.tscn | 2 +- scripts/player/player_camera.gd | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scenes/player.tscn b/scenes/player.tscn index 11fa8f9..9067470 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -135,7 +135,7 @@ cull_mask = 1048573 fov = 90.0 script = ExtResource("3_qhqgy") compensation_time = 0.1 -compensation_delay = 0.1 +compensation_delay = 0.2 [node name="molikman_hands" parent="Camera3D" instance=ExtResource("4_dqkch")] transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, -1, 0) diff --git a/scripts/player/player_camera.gd b/scripts/player/player_camera.gd index 6d10ea7..ed06b28 100644 --- a/scripts/player/player_camera.gd +++ b/scripts/player/player_camera.gd @@ -42,7 +42,10 @@ func rotate_camera(x,y) -> void: rotation.x = clamp(rotation.x + y,-PI/2,PI/2) orthonormalize() if sign(vertical_compensation) == sign(y): - vertical_compensation -= y + if abs(vertical_compensation) - abs(y) < 0: + vertical_compensation = 0 + else: + vertical_compensation -= y func recoil(x,y) -> void: rotate_camera(x,y) @@ -55,5 +58,4 @@ func recoil(x,y) -> void: func start_compensating() -> void: compensate = true - print(vertical_compensation) compensation_speed = vertical_compensation / compensation_time