Skip to content

Commit 6d9f9c8

Browse files
Add crouch factor
1 parent 72c0246 commit 6d9f9c8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

abilities/crouch_ability_3d.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class_name CrouchAbility3D
1818
## Collider height when crouch deactived
1919
@export var default_height := 2.0
2020

21+
var crouch_factor : float
2122

2223
## Applies slow if crouch is enabled
2324
func get_speed_modifier() -> float:
@@ -33,4 +34,5 @@ func apply(velocity: Vector3, speed : float, is_on_floor : bool, direction : Vec
3334
elif not head_check.is_colliding():
3435
collision.shape.height += delta * 8
3536
collision.shape.height = clamp(collision.shape.height , height_in_crouch, default_height)
37+
crouch_factor = (default_height - height_in_crouch) - (collision.shape.height - height_in_crouch)/ (default_height - height_in_crouch)
3638
return velocity

0 commit comments

Comments
 (0)