|
|
@ -3,11 +3,12 @@ extends CharacterBody3D |
|
|
|
|
|
|
|
|
|
|
|
@export var acceleration: float = 10.0 |
|
|
|
@export var crouch_height: float = 0.95 |
|
|
|
@export var crouch_speed: float = 3.0 |
|
|
|
@export var jump_velocity: float = 4.5 |
|
|
|
@export var crouch_height: float = 0.95 ## Camera and RayCast height |
|
|
|
@export var mouse_sensitivity_horizontal: float = 0.002 |
|
|
|
@export var mouse_sensitivity_vertical: float = 0.002 |
|
|
|
@export var standing_height: float = 1.8 ## Camera and RayCast height |
|
|
|
@export var walk_speed: float = 5.0 |
|
|
|
@export var run_speed: float = 8 |
|
|
|
|
|
|
@ -50,10 +51,12 @@ func handle_crouching(delta: float) -> void: |
|
|
|
collision_shape_crouching.disabled = false |
|
|
|
collision_shape_standing.disabled = true |
|
|
|
camera.transform.origin.y = lerp(camera.transform.origin.y, crouch_height, acceleration * delta) |
|
|
|
ray_cast_look.transform.origin.y = crouch_height |
|
|
|
elif !ray_cast_crouch.is_colliding(): |
|
|
|
collision_shape_crouching.disabled = true |
|
|
|
collision_shape_standing.disabled = false |
|
|
|
camera.transform.origin.y = lerp(camera.transform.origin.y, 1.8, acceleration * delta) |
|
|
|
camera.transform.origin.y = lerp(camera.transform.origin.y, standing_height, acceleration * delta) |
|
|
|
ray_cast_look.transform.origin.y = standing_height |
|
|
|
else: |
|
|
|
pass # Continue crouching until nothing overhead |
|
|
|
|
|
|
|