I set my NavRegion3D to have an agent radius of 0.5 and I have a capsule mesh with a radius if 0.5. The capsule directly follows its 'get_next_path_position' path, but the mesh still clips through the walls where I would expect it to avoid them as the agent radius and mesh capsule radius are equal. Could someone explain this behavior?
#Don't quite understand Navigation behavior
1 messages · Page 1 of 1 (latest)
the navigation agent has a path desired distance. If it gets within that distance to the next path point it goes to the next point. If that distance is set too large it will skip corners, if it is too small for the agent speed it will get stuck on points. You need to adjust that to your actor behavior and layout.
also if you use a physics node for your character, physics is a stepped process with margins and velocity drag with its movement, so having the same size is often not enough to avoid collision and you need to bake the navmesh with a bigger agent radius to avoid most issues caused by physics behavior.
Ahhhh perfect. I had seen some of your posts on other similar questions but didn't fully internalize how the path_desired_distance parameter was explained but this makes perfect sense.
No physics objects are being used other than static bodies in the baking of the navmesh. I made the agent size 0.55, and the path desired distance 0.1 and it worked perfectly. Is there a computational downside to having the path desired distance that low?
Changing cell size also helped. Got radius 0.5 working by slightly tweaking cell size
cell size increases the voxel count, so you get more detailed quality for (very) slow bake times. That might work when your levels are small and you only bake in the editor. For runtime changes and rebakes you want to have the highest cell size that still works for your project to improve rebake speed.
changing the path desired distance has no downside for performance, the agent checks the distance on each update no matter what.
I figured as much but good to know for sure.
Yeah I spent some time messing with it to minimize voxels and kept bumping size up but decreasing max error a bit to get a navmesh that works well for me. Luckily for my project any rebakes of the mesh wont be time critical nor very big
Id assume max error isn't something that would effect bake times much, no?
max error is a postprocessing of the baking, it is used after the source geometry got already rasterized in the voxel grid to define the edges of the final navmesh. When the error margin is very low it will follow the voxel contours more closely and do some extra computations. With a high error margin it can skip some calculation loops a little earlier and be slightly faster. The error margin is mostly about quality as it avoids having a lot of extra edges added by small voxel cells that are just a single cell offset from a very long edge.