Characters floating on the east side of the plaza, and the culprit was the NavMesh height mesh
Characters floating on the east side of the plaza weren't a terrain issue. It was the height precision of a NavMesh baked after the stage was added. I turned on the height mesh and rebaked the village and three interiors, bringing floating spots down to 0.
Walking around the village, the character would bob up and come back down, as if there were an invisible ledge. Looking closer, they really were floating. It was most noticeable on the east side of the plaza, in front of Luka the merchant.
It started after I built the plaza stage, so I suspected a terrain bug. With the goal of keeping characters glued to the ground both in the village and indoors, I started by hunting down the cause.
What I built
I rebaked the NavMesh for the village and the three interiors (guild, blacksmith, tavern) with the height mesh turned on. Now characters follow the actual floor height instead of simplified polygons.
- Spots on the east strip of the plaza floating more than 0.15 m above the terrain: 31 (max 0.84 m) → 0
- Spots indoors floating more than 0.3 m: 1 in the blacksmith, 9 in the tavern (around the hall stairs) → 0 everywhere. The guild had 0 from the start
In Play, I walked the problem stretch from (5.6, 0.6) to (20, 2.6), and the height above ground stayed at 0.00 m the whole way. Standing in front of Luka and Noel, it sits at −0.001 m, right on the ground. Climbing the stairs from the ground onto the stage works fine too (a 0.25 m difference per step at the stair edge).
I also measured the whole 80 × 80 m village at 0.5 m intervals (about 19,000 points), and 12 spots came out more than 0.3 m above the floor. All of them were rays hitting the ground through the gap between two stair modules, and the NavMesh was correctly at stair height there. In the three interiors, paths also connect from the arrival point to the talk spots and the doors.
I also added two menus (one for the village, one for interiors) that only rebake the NavMesh in the open scene. For interiors it just bakes, without rebuilding the scene.
Things I thought about
- Fixing the NavMesh, not the terrain. There's no collider at that spot, and the terrain and stone path height is 0. The only thing floating was the pathfinding floor.
- Always use a height mesh in scenes with height changes. Scenes with a stage, stairs or a sunken hall bake with the height mesh on. The village generator and the plaza/fence rebuild menus all go through the same bake function, so this is automatic from now on. I also added it to the pitfalls list in my interior notes.
Rabbit hole: an invisible slope in midair
From the stage's east stairs at (6.5, 0.5) to the eastern main road at (20, 2.5), the NavMesh floated 0.3–0.84 m at 31 points in a strip. Characters were rising up along it and then coming back down.
The cause was how the NavMesh simplifies large flat areas into big polygons. There were seven long, thin triangles connecting vertices on the top edge of the stage (0.97 m) to ground vertices 20–43 m away. When height correction is coarse, the height inside a polygon is just a straight line between vertices, which created a gentle slope in midair from the stairs to the main road.
So it wasn't a terrain bug. It was a height precision problem in the NavMesh I baked after adding the plaza stage (0.89 m). My hunch that the stage set it off was right, at least. I fixed it by turning on the height mesh and rebaking.
Next up
- Walk around myself to check. If it floats anywhere else, start from that spot
