From 4b9e30c624eeb7624799b1326c2d033c16254172 Mon Sep 17 00:00:00 2001 From: VinPropane Date: Sun, 5 Apr 2026 01:01:22 -0400 Subject: [PATCH] NS-23: fix false arrival when leaving bump tops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VERT_ARRIVE_EPS (0.16) was larger than the bump rise (~0.12–0.15), so a floor click beside the plateau often satisfied arrival (horiz + vert) on the first frame and cleared the walk goal before any motion. Tighten vertical arrival to 0.055. Add a steer fallback when the target shares xz but is lower (plateau vs floor underfoot) so we still pick a horizontal escape toward the rim. --- client/scripts/player.gd | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/scripts/player.gd b/client/scripts/player.gd index 05caaea..d921752 100644 --- a/client/scripts/player.gd +++ b/client/scripts/player.gd @@ -5,7 +5,9 @@ extends CharacterBody3D const MOVE_SPEED: float = 5.0 const ARRIVE_EPS: float = 0.35 -const VERT_ARRIVE_EPS: float = 0.16 +## Must be **below** NS-19 bump rise (~0.12–0.15) or we "arrive" while still on the plateau when the +## goal is on the floor beside the bump (small horiz offset + ~0.15 m vertical). +const VERT_ARRIVE_EPS: float = 0.055 const MAX_CLIMB_SPEED: float = 2.6 const MAX_DESCENT_SPEED: float = 2.2 const DIRECT_APPROACH_RADIUS: float = 0.85 @@ -57,6 +59,12 @@ func _steer_toward_world_point(point: Vector3) -> void: var desired: Vector3 = delta.normalized() * MOVE_SPEED desired.y = clampf(desired.y, -MAX_DESCENT_SPEED, MAX_CLIMB_SPEED) velocity = desired + elif dy < -0.04: + # Goal is lower and almost same xz (e.g. floor under the plateau): still need rim escape. + var escape_h := Vector3(-global_transform.basis.z.x, 0.0, -global_transform.basis.z.z) + if escape_h.length_squared() < 1e-8: + escape_h = Vector3(1.0, 0.0, 0.0) + velocity = escape_h.normalized() * MOVE_SPEED else: velocity = Vector3.ZERO