Attempt at fixing player ledge jump glitch

unbroken
unfa 2021-05-22 02:10:00 +02:00
parent c4cf1d789a
commit 6316952ca5
2 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,7 @@ extends KinematicBody3D
#var speed := 15
@onready var head = $Head
@onready var ground_check = $GroundCheck
var direction := Vector3.ZERO
var accel := 0
@ -54,7 +55,7 @@ func _input(event) -> void:
func _physics_process(delta):
direction = Vector3.ZERO
if is_on_floor():
if is_on_floor() and ground_check.is_colliding():
snap = -get_floor_normal()
medium = "ground"
gravity_vec = Vector3.ZERO

View File

@ -15,7 +15,7 @@ radius = 0.25
height = 0.5
[node name="Player" type="KinematicBody3D"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2, 0 )
script = ExtResource( 1 )
[node name="Mesh" type="MeshInstance3D" parent="."]
@ -45,3 +45,9 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0 )
shape = SubResource( 3 )
disabled = true
script = null
[node name="GroundCheck" type="RayCast3D" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0 )
target_position = Vector3( 0, -1.1, 0 )
debug_shape_thickness = 5.0
script = null