Quick answer: Set NavigationAgent2D’s path_postprocessing to PATH_POSTPROCESSING_EDGECENTERED to center routes between polygon edges instead of hugging corners. For further smoothness, apply steering in your movement code.

Here is how to fix Godot 4 NavigationAgent2D paths that zig-zag visibly across the navmesh polygons. The default postprocessing produces routes that hug polygon edges; switching to edge-centered or applying smoothing in code yields cleaner motion.

The Symptom

Agent walks from A to B but the path bends at every navigation polygon boundary, producing visible zig-zag instead of a clean diagonal.

What Causes This

Edge-following postprocessing. Default mode follows polygon edges, which can be jagged depending on mesh topology.

Sparse navigation polygon. Few large polygons produce few path nodes; routes look chunky.

No agent smoothing. Direct setting velocity to (next_pos - position).normalized produces sharp turns.

The Fix

Step 1: Switch postprocessing.

agent.path_postprocessing = NavigationPathQueryParameters2D.PATH_POSTPROCESSING_EDGECENTERED

Edge-centered routes pass through the middle of shared edges between polygons.

Step 2: Smooth movement.

extends CharacterBody2D

@onready var agent: NavigationAgent2D = $NavigationAgent2D

func _physics_process(delta):
    if agent.is_navigation_finished():
        velocity = velocity.lerp(Vector2.ZERO, 5 * delta)
    else:
        var next = agent.get_next_path_position()
        var desired = (next - global_position).normalized() * 200
        velocity = velocity.lerp(desired, 10 * delta)
    move_and_slide()

Steering smoothing turns sharp corners into curves.

Step 3: Densify the navigation polygon. If the navmesh has few large polygons, even smoothing produces straight chunks. Add more vertex detail in NavigationRegion2D, or use NavigationMeshSourceGeometryData2D to bake from finer source.

Step 4: Tune arrival thresholds.

agent.path_desired_distance = 8.0
agent.target_desired_distance = 10.0

Smaller values arrive precisely; larger reduce jitter near targets.

Step 5: Enable avoidance for groups. If multiple agents pathfind to the same area, NavigationAgent2D’s built-in avoidance smooths group motion. Enable avoidance_enabled and radius.

“Edge-centered postprocess plus steering smoothing. Two changes turn zig-zag into a clean route.”

Related Issues

For Area2D monitoring, see Area2D Monitoring. For CharacterBody2D collision, see Ghost Collision.

Edge-centered. Smooth velocity. Tighter polygons. Routes look right.