NS-23: remove descend nav skip — restored obstacle pathing
goal.y < body.y matched almost every move because ray picks use floor Y while CharacterBody3D origin is mid-capsule, so we always bee-lined and ignored waypoints. Rely on small-xz next-waypoint fallback for bump rims instead.pull/23/head
parent
e1beb82a75
commit
72eef09d15
|
|
@ -6,15 +6,12 @@ extends CharacterBody3D
|
|||
## and steps comes from `move_and_slide` + floor_* on CharacterBody3D. Move **legality** (step,
|
||||
## distance, bounds) is server MoveCommand only — not reimplemented here.
|
||||
##
|
||||
## Nav detours except when goal Y is below us: then xz toward goal (waypoints sit under bump rims).
|
||||
## Nav for detours; if next waypoint has almost no xz offset, steer xz toward goal.
|
||||
|
||||
const MOVE_SPEED: float = 5.0
|
||||
const ARRIVE_EPS: float = 0.35
|
||||
const VERT_ARRIVE_EPS: float = 0.055
|
||||
const DIRECT_APPROACH_RADIUS: float = 0.85
|
||||
## Server goal clearly below us (descending). Nav mesh waypoints are often under the rim first;
|
||||
## steering at next gives almost no horizontal speed — walk out on xz toward the authorized goal.
|
||||
const DESCEND_GOAL_Y_MARGIN: float = 0.06
|
||||
|
||||
var _has_walk_goal: bool = false
|
||||
var _auth_walk_goal: Vector3 = Vector3.ZERO
|
||||
|
|
@ -76,11 +73,6 @@ func _physics_process(_delta: float) -> void:
|
|||
move_and_slide()
|
||||
return
|
||||
|
||||
if _auth_walk_goal.y < global_position.y - DESCEND_GOAL_Y_MARGIN:
|
||||
_set_horizontal_velocity_toward(_auth_walk_goal)
|
||||
move_and_slide()
|
||||
return
|
||||
|
||||
if horiz_dist <= DIRECT_APPROACH_RADIUS:
|
||||
_set_horizontal_velocity_toward(_auth_walk_goal)
|
||||
else:
|
||||
|
|
@ -88,6 +80,7 @@ func _physics_process(_delta: float) -> void:
|
|||
var to_next_h: Vector3 = Vector3(
|
||||
next_path_position.x - global_position.x, 0.0, next_path_position.z - global_position.z
|
||||
)
|
||||
# “goal Y < body Y” skips nav wrongly: pick is floor height, body origin is higher.
|
||||
if to_next_h.length_squared() > 0.0025:
|
||||
_set_horizontal_velocity_toward(next_path_position)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue