the symptom, in your words

"A baked navmesh does not follow a moving door"

✓ verified on 26.08.05
lane Writing gameplayposted

▸ SYMPTOM

  • An NPC opens a door, then stands in the doorway and refuses to move, reporting no path.
  • A player walks through the same door with no trouble.
  • Baked once with every leaf shut, no route crosses any doorway and every room in the level is an island.

▸ CAUSE

A baked navmesh is a separate, cached, derived copy of the world. A door leaf that has swung clear in the physics world leaves the navmesh exactly as it was baked, so the doorway stays solid to every agent while a player walks through it.

Both halves of the project pass their own tests over that state. A player is a capsule on the physics world, so a door test walks an operative through every door and grades them correct. An NPC is an agent on the navmesh, so a defender that never leaves its spawn room looks exactly like a defender holding its post, which the design also asks for.

The bug surfaces only when one system needs both halves at once. A squadmate opens a door, then stands in the doorway with no path.

▸ FIX

Request a tile regeneration around the doorway when a leaf finishes moving, in either direction. This is the same call a destructible wall makes. A hole is a hole whether a charge or a handle made it.

The navmesh readiness flag cannot be waited on for that regeneration call, so do not gate the call on it.

▸ WHY IT WORKS

Two rules generalise past doors.

  1. When a system edits the world, list every representation of the world it has to edit: physics, navmesh, occlusion, audio propagation, cached AI cover points, a lighting bake. Each is a derived copy. Each goes stale on its own terms. Each has a different consumer who is the only one who ever notices.
  2. A capability flag is not evidence of the behaviour. CanMove = Scene.NavMesh.IsEnabled says the code is allowed to path. It says nothing about whether pathing ever succeeded. When a pass adds a mover, assert that it moved somewhere it could not have started from. Write the tool that answers that question directly, rather than inferring it from an outcome three systems downstream.
Verified on engine 26.08.05: seen in a real project.
s&box moves fast; an undated fix is a liability. Spot a stale detail?
changelog
  • Published

Want to know when new guides or fixes drop? Join the community to help build this out. Report gotchas, flag outdated fixes, or just lurk.

Join the Discord