NS-23: horizontal nav steering so bump-top departure works

Path waypoints from the plateau often sit on the slope almost under the
player (same xz, lower y). 3D steer + y clamp gave almost no horizontal
velocity, so standing on top then clicking off looked stuck. Steer in xz
at MOVE_SPEED and let move_and_slide follow floor/slope; keep 3D only for
vertical climb when xz is aligned.
pull/23/head
VinPropane 2026-04-05 00:58:10 -04:00
parent f6baf3bf72
commit 7ffcf54d80
1 changed files with 18 additions and 6 deletions

View File

@ -40,13 +40,25 @@ func snap_to_server(world_pos: Vector3) -> void:
func _steer_toward_world_point(point: Vector3) -> void:
var delta: Vector3 = point - global_position
if delta.length_squared() < 1e-8:
velocity = Vector3.ZERO
var pos := global_position
var delta_h: Vector3 = Vector3(point.x - pos.x, 0.0, point.z - pos.z)
# Full 3D toward a waypoint that is mostly *below* (same xz, on the slope) while standing on
# the plateau yields almost no horizontal speed, so you never reach the rim. Nav in xz + floor
# slide handles ramps and departure from bump tops.
if delta_h.length_squared() > 1e-8:
velocity = delta_h.normalized() * MOVE_SPEED
return
var desired: Vector3 = delta.normalized() * MOVE_SPEED
desired.y = clampf(desired.y, -MAX_DESCENT_SPEED, MAX_CLIMB_SPEED)
velocity = desired
var dy: float = point.y - pos.y
if dy > 0.08:
var delta: Vector3 = point - pos
if delta.length_squared() < 1e-8:
velocity = Vector3.ZERO
return
var desired: Vector3 = delta.normalized() * MOVE_SPEED
desired.y = clampf(desired.y, -MAX_DESCENT_SPEED, MAX_CLIMB_SPEED)
velocity = desired
else:
velocity = Vector3.ZERO
func _physics_process(_delta: float) -> void: