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