NEON-29: Tie tread XZ freeze to peel suspend + vert arrival band.

Replace vlat/ncol + tight vert_sep window (often missed or band-flickered) with:
peel suspend, horiz_dist <= 0.38 m, VERT_ARRIVE_EPS < verr <= 0.18 m, goal
not above feet. Aligns freeze with tread snap/peel regime; caps XZ against
5 m peel-suspend fallback.
pull/41/head
VinPropane 2026-04-12 19:44:53 -04:00
parent ea3903d8ab
commit db7973d368
1 changed files with 17 additions and 16 deletions

View File

@ -38,13 +38,12 @@ const WALK_PEEL_SUSPEND_VERT_SEP: float = 0.48
## so shallow lips (~0.48 m) still peel; widened from 0.34 to cover ~0.350.47 m stair/goal gaps.
const WALK_PEEL_SUSPEND_HORIZ_VERT_SEP: float = 0.46
const WALK_PEEL_SUSPEND_HORIZ_DIST: float = 5.0
## In [code]vlat && ncol[/code], when XZ is almost at arrival but [code]vert_sep[/code] sits in a tread
## wobble band (~4.513 cm), full [member MOVE_SPEED] slide keeps pumping Y (NEON-16 ~0.890.95). Zero
## horizontal [member velocity] for that tick so only floor snap settles height — narrow gates avoid
## freezing open-floor approaches or long vertical offsets.
const WALK_TREAD_FREEZE_HORIZ_FRAC: float = 0.92
const WALK_TREAD_FREEZE_VERT_SEP_MIN: float = 0.045
const WALK_TREAD_FREEZE_VERT_SEP_MAX: float = 0.13
## With [method _walk_peel_suspend_near_goal] (tread snap/peel stability), zero XZ [member velocity] when
## close in XZ but vertical arrival still unresolved — avoids band-edge flicker from a tight [code]vert_sep[/code]
## window. [member WALK_PEEL_SUSPEND_HORIZ_DIST] can be 5 m; cap XZ here so we never freeze long crosses.
const WALK_TREAD_FREEZE_HORIZ_MAX: float = 0.38
## Freeze only while vertical error is in a “tread wobble” band (past arrival noise, not a big drop).
const WALK_TREAD_FREEZE_VERT_ERR_MAX: float = 0.18
## [method _walk_has_close_floor_probe_below] often flips on stairs: next tread is ~0.104 m down but
## [member WALK_CONTINUATION_MAX_BELOW_FEET] is 0.078 m, so rays reject the hit → peel + zero snap
## alternate with full snap each tick (~y≈1.0 jitter). Require this many consecutive probe-fail frames
@ -502,21 +501,23 @@ func _walk_peel_suspend_near_goal(feet_y: float, horiz_dist: float) -> bool:
return vsep <= WALK_PEEL_SUSPEND_HORIZ_VERT_SEP and horiz_dist <= WALK_PEEL_SUSPEND_HORIZ_DIST
func _walk_tread_freeze_horizontal_active(feet_y: float, horiz_dist: float) -> bool:
func _walk_tread_freeze_horizontal_active(_feet_y: float, horiz_dist: float) -> bool:
if not is_on_floor() or not _has_walk_goal:
return false
# Step-up / climb still needs XZ motion along the face.
if _auth_walk_goal.y > feet_y + 0.04:
if _auth_walk_goal.y > _feet_y + 0.04:
return false
if horiz_dist > ARRIVE_EPS * WALK_TREAD_FREEZE_HORIZ_FRAC:
if not _walk_peel_suspend_near_goal(_feet_y, horiz_dist):
return false
var vsep: float = absf(_auth_walk_goal.y - feet_y)
if vsep <= WALK_TREAD_FREEZE_VERT_SEP_MIN or vsep > WALK_TREAD_FREEZE_VERT_SEP_MAX:
if horiz_dist > WALK_TREAD_FREEZE_HORIZ_MAX:
return false
if _walk_vert_route_latched and _walk_nav_column_steering:
return true
# [code]vlat[/code] can unlatch on long descents; keep freeze only when clearly dropping.
return _auth_walk_goal.y < feet_y - DESCEND_GOAL_Y_MARGIN
var cap_half: float = CAPSULE_HALF_HEIGHT + PLAYER_CAPSULE_RADIUS
var verr: float = vertical_arrival_error(_auth_walk_goal.y, global_position.y, cap_half)
if verr <= VERT_ARRIVE_EPS:
return false
if verr > WALK_TREAD_FREEZE_VERT_ERR_MAX:
return false
return true
func _walk_refresh_ledge_peel_debounce(feet_y: float, move_dir_xz: Vector2) -> void: