NS-23: Remove bump rim velocity unstick (fixes edge vibration)

Per-frame wall-normal + goal boosts fought a flipping wall normal and capped
re-vectoring, causing back-and-forth jitter. Drop _apply_bump_rim_wall_unstick
and related helpers/constants; keep direct step-down + footprint logic only.
STEP_OFF_DESCEND_SPEED 2.2 → 1.75.
pull/23/head
VinPropane 2026-04-05 01:58:57 -04:00
parent 430770e5bf
commit 25d21c0011
1 changed files with 1 additions and 47 deletions

View File

@ -25,12 +25,7 @@ const FLOOR_PROBE_BODY_Y_OFFSET: float = -0.55
## Extra xz rays for step-off; max Y keeps bump support when center ray sees floor first.
const STEP_FOOTPRINT_HALF: float = 0.2
## Downward vy only while step-off bypass is active (not global gravity).
const STEP_OFF_DESCEND_SPEED: float = 2.2
## Peel off frustum wall when sliding tangentially along the rim (m/s, added to xz velocity).
const BUMP_RIM_WALL_PUSH: float = 2.6
## Extra push toward goal xz while on a wall in that rim case (m/s).
const BUMP_RIM_GOAL_BOOST: float = 1.15
const BUMP_RIM_MAX_HORIZ_MULT: float = 1.38
const STEP_OFF_DESCEND_SPEED: float = 1.75
## If next waypoint is within this xz of us, steer to goal (rim / underfoot waypoints).
const NEXT_WAYPOINT_MIN_HORIZ_SQ: float = 0.01
## Editor group on stepped bump colliders; value must match `main.tscn`.
@ -198,44 +193,6 @@ func _set_horizontal_velocity_toward(point: Vector3) -> void:
velocity.y = 0.0
func _departing_bump_step_to_lower_floor() -> bool:
var fp: Dictionary = _footprint_step_down_state()
if not bool(fp["touches_bump_step"]):
return false
var max_y: float = float(fp["max_y"])
var dest_y: float = _destination_footing_y()
return max_y >= dest_y + STEP_OFF_MIN_DROP
## Frustum walls turn “toward goal” into tangential rim slide; nudge out + along goal, capped.
func _apply_bump_rim_wall_unstick() -> void:
if not _departing_bump_step_to_lower_floor():
return
var pos: Vector3 = global_position
var to_g: Vector3 = Vector3(_auth_walk_goal.x - pos.x, 0.0, _auth_walk_goal.z - pos.z)
var lg: float = to_g.length_squared()
if lg < 1e-14:
return
to_g /= sqrt(lg)
if is_on_wall():
var wn: Vector3 = get_wall_normal()
var wn_h: Vector3 = Vector3(wn.x, 0.0, wn.z)
var lw: float = wn_h.length_squared()
if lw > 1e-12:
wn_h /= sqrt(lw)
if wn_h.dot(to_g) >= -0.32:
velocity.x += wn_h.x * BUMP_RIM_WALL_PUSH
velocity.z += wn_h.z * BUMP_RIM_WALL_PUSH
velocity.x += to_g.x * BUMP_RIM_GOAL_BOOST
velocity.z += to_g.z * BUMP_RIM_GOAL_BOOST
var cap: float = MOVE_SPEED * BUMP_RIM_MAX_HORIZ_MULT
var h: Vector2 = Vector2(velocity.x, velocity.z)
if h.length_squared() > cap * cap:
h = h.normalized() * cap
velocity.x = h.x
velocity.z = h.y
func _physics_process(_delta: float) -> void:
if not _has_walk_goal:
velocity = Vector3.ZERO
@ -261,14 +218,12 @@ func _physics_process(_delta: float) -> void:
var nav_map: RID = _nav_agent.get_navigation_map()
if NavigationServer3D.map_get_iteration_id(nav_map) == 0:
_set_horizontal_velocity_toward(_auth_walk_goal)
_apply_bump_rim_wall_unstick()
move_and_slide()
return
if _use_direct_step_down_steering():
_set_horizontal_velocity_toward(_auth_walk_goal)
velocity.y = -STEP_OFF_DESCEND_SPEED
_apply_bump_rim_wall_unstick()
move_and_slide()
return
@ -284,5 +239,4 @@ func _physics_process(_delta: float) -> void:
else:
_set_horizontal_velocity_toward(_auth_walk_goal)
_apply_bump_rim_wall_unstick()
move_and_slide()