Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

docs(nav): the navmesh can be seen before the game runs

esengine678224312d24
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3584d37d..824514a7a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -268,6 +268,20 @@ published separately; it ships inside the editor.
### Added
+- **The navmesh is visible while a scene is being authored.** The volume's
+ wireframe said where the bake would LOOK; what it found could only be seen by
+ entering Play and turning on a runtime overlay, which is how `cellSize`,
+ `agentRadius` and `agentHeight` came to be tuned by watching whether an agent
+ happened to move. **View → Show Navigation Mesh** (and a viewport toolbar
+ button) bakes the scene's volume in the editor and draws the walkable faces
+ where they are, with the edges they stop at picked out. It rebakes as the scene
+ changes — at most a few times a second, since a bake is the most expensive thing
+ an edit can ask for — so widening `agentRadius` pulls the mesh back from the
+ walls in front of you. It is the same `buildNavMesh` the running game calls, so
+ the picture and the routes cannot be two different answers. New editor check
+ `navmesh-preview`, which asks for an AREA rather than ink (a box outline is ink)
+ and for the area to shrink when the agent is widened.
+
- **Right-drag turns the editor eye.** It panned, like the middle button, so the
only way to look around a 3D scene was Alt-drag. Right-drag now turns a view that
has somewhere to turn to — a perspective one, or one already off head-on — and
diff --git a/desktop b/desktop
index c83b72384..91b6de7b8 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit c83b723844d70defd8e0f52a8f13b87cdceb34f4
+Subproject commit 91b6de7b82b50adef9e50fa968d8c0143ef0dd3a
diff --git a/docs/astro/src/content/docs/gameplay/ai/navigation.mdx b/docs/astro/src/content/docs/gameplay/ai/navigation.mdx
index c7ecd1120..e24293763 100644
--- a/docs/astro/src/content/docs/gameplay/ai/navigation.mdx
+++ b/docs/astro/src/content/docs/gameplay/ai/navigation.mdx
@@ -102,8 +102,14 @@ on its own terms, and `collectNavGeometry(world, box)` is what gathers the trian
### Seeing what was baked
-The volume's wireframe says where the bake looked. To see what it **found**, turn
-on the `NavDebugDraw` resource in the running game:
+The volume's wireframe says where the bake looked. To see what it **found** while
+you are still authoring, turn on **View → Show Navigation Mesh** (or the Navigation
+button on the viewport toolbar): the editor bakes the scene's volume and draws the
+walkable faces where they are, with the edges they stop at picked out. It rebakes
+as the scene changes, so widening `agentRadius` pulls the mesh back from the walls
+in front of you.
+
+The same picture from inside a running game comes from the `NavDebugDraw` resource:
```typescript
app.getResource(NavDebugDraw).enabled = true;
diff --git a/docs/astro/src/content/docs/zh-cn/gameplay/ai/navigation.mdx b/docs/astro/src/content/docs/zh-cn/gameplay/ai/navigation.mdx
index f80ad5740..ae31af4b9 100644
--- a/docs/astro/src/content/docs/zh-cn/gameplay/ai/navigation.mdx
+++ b/docs/astro/src/content/docs/zh-cn/gameplay/ai/navigation.mdx
@@ -91,7 +91,12 @@ export const setupNav = defineSystem([Res(Nav)], (nav) => {
### 看见烘出来的东西
-体积的线框说的是烘焙**往哪看**。想看它**找到了什么**,在运行中的游戏里打开 `NavDebugDraw`:
+体积的线框说的是烘焙**往哪看**。想在还在编排场景的时候就看见它**找到了什么**,打开
+**视图 → 显示导航网格**(或视口工具栏上的「导航」按钮):编辑器会烘焙场景里的体积,
+把可走的面画在它们实际所在的位置,并把它们终止的那些边挑出来。场景一变它就重烘,
+所以把 `agentRadius` 调宽时,网格是当着你的面从墙上缩回去的。
+
+同一张图在运行中的游戏里由 `NavDebugDraw` 资源给出:
```typescript
app.getResource(NavDebugDraw).enabled = true;