NEON-29: Descend lip peel when on_floor + wallish (first step → floor)
First terrace step to main floor could stall: is_on_floor stayed true on the step top while a vertical face zeroed horizontal motion; vy was reset to 0 so no gravity ran. Taller drops broke contact sooner so second→floor worked. While descending (goal below feet) and on floor, if is_on_wall or any slide normal is wall-ish (ny < 0.55), integrate gravity into vy before move_and_slide.pull/41/head
parent
2a25a24e0b
commit
f70dbe8f88
|
|
@ -250,9 +250,28 @@ func _set_horizontal_velocity_toward(point: Vector3, fallback_dir_xz: Vector3 =
|
|||
## While walking, integrate gravity when airborne so Jolt can register floor contacts and
|
||||
## `move_and_slide` is not stuck with vy=0 above the surface (expanded district / terraces).
|
||||
func _apply_walk_air_gravity(delta: float) -> void:
|
||||
if is_on_floor():
|
||||
var g_step: Vector3 = get_gravity() * delta
|
||||
if not is_on_floor():
|
||||
velocity += g_step
|
||||
return
|
||||
velocity += get_gravity() * delta
|
||||
# Descending toward a lower surface (e.g. first terrace step → main floor): rim / internal
|
||||
# edge contact can keep `is_on_floor()` true on the upper surface while the step's vertical
|
||||
# face zeros horizontal motion. With vy forced to 0 by `_set_horizontal_velocity_toward`,
|
||||
# no gravity ran and the capsule could hang until a new click retargeted. Shallow 0.3 m
|
||||
# drops hit this more often than taller platform→floor descents.
|
||||
var feet_on_floor: float = capsule_feet_y(global_position.y, CAPSULE_HALF_HEIGHT + PLAYER_CAPSULE_RADIUS)
|
||||
var descending: bool = (
|
||||
_has_walk_goal and _auth_walk_goal.y < feet_on_floor - DESCEND_GOAL_Y_MARGIN
|
||||
)
|
||||
if descending and g_step.y < 0.0:
|
||||
var wallish: bool = is_on_wall()
|
||||
if not wallish:
|
||||
for i: int in get_slide_collision_count():
|
||||
if get_slide_collision(i).get_normal().y < 0.55:
|
||||
wallish = true
|
||||
break
|
||||
if wallish:
|
||||
velocity.y += g_step.y
|
||||
|
||||
|
||||
## When the authoritative goal shares XZ with the capsule (e.g. terrace above), horizontal
|
||||
|
|
|
|||
Loading…
Reference in New Issue