From 39b476027042c458bb63dd18d189635634ac2762 Mon Sep 17 00:00:00 2001 From: VinPropane Date: Sun, 5 Apr 2026 02:06:06 -0400 Subject: [PATCH] NS-23: Skip move_and_slide when idle on floor (stop rest jitter) Zero-velocity move_and_slide each physics tick still reapplies floor snap and collision, which often reads as vibration. If there is no walk goal (or we just arrived), velocity is zero, and is_on_floor(), return early. --- client/scripts/player.gd | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/scripts/player.gd b/client/scripts/player.gd index 1449e61..0ff126f 100644 --- a/client/scripts/player.gd +++ b/client/scripts/player.gd @@ -7,6 +7,9 @@ extends CharacterBody3D ## 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). +## +## Idle: skip `move_and_slide()` when on floor and velocity is zero — repeated slide + floor snap +## causes visible micro-vibration at rest. const MOVE_SPEED: float = 5.0 const ARRIVE_EPS: float = 0.35 @@ -54,9 +57,15 @@ func _set_horizontal_velocity_toward(point: Vector3) -> void: velocity.y = 0.0 +func _skip_move_when_idle_on_floor() -> bool: + return is_on_floor() and velocity.length_squared() < 1e-12 + + func _physics_process(_delta: float) -> void: if not _has_walk_goal: velocity = Vector3.ZERO + if _skip_move_when_idle_on_floor(): + return move_and_slide() return @@ -67,6 +76,8 @@ func _physics_process(_delta: float) -> void: velocity = Vector3.ZERO _has_walk_goal = false _nav_agent.set_target_position(global_position) + if _skip_move_when_idle_on_floor(): + return move_and_slide() return