From 7a9b986774e37ad45fbb70a46a2d65286c48c27a Mon Sep 17 00:00:00 2001 From: Eduardo Fernandez Date: Mon, 12 Feb 2024 00:12:07 +0100 Subject: [PATCH] fix: squating was making the player fall troght the floor --- player/Player.gd | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/player/Player.gd b/player/Player.gd index b551065..7d040ae 100644 --- a/player/Player.gd +++ b/player/Player.gd @@ -20,9 +20,9 @@ signal recharge_battery var target_velocity := Vector3.ZERO var noise: float = 0 -const squat_position := 0.6 # Position to which the camera moves when squatting -const stand_position := 1.7 # Position to which the camera moves when standing -const move_speed := 8.0 # Speed at which the camera moves from stand to squat and back +const squat_scale := 0.4 # Position to which the camera moves when squatting +const stand_scale := 1 # Position to which the camera moves when standing +const squat_speed := 2.5 # Speed at which the camera moves from stand to squat and back var is_squatting := false var object_detected: Object = null @@ -43,10 +43,10 @@ func _physics_process(delta): elif Input.is_action_just_released("squat"): is_squatting = false - if is_squatting and camera.position.y > squat_position: - scale.y = scale.y * -move_speed * delta - elif not is_squatting and camera.position.y < stand_position: - scale.y = scale.y * move_speed * delta + if is_squatting and scale.y > squat_scale: + scale.y = scale.y - squat_speed * delta + elif not is_squatting and scale.y < stand_scale: + scale.y = scale.y + squat_speed * delta if Input.is_action_pressed("squat"): speed_mod = squating_speed_mod -- 2.30.2