Recast not covering the terrain nicely

Hello,

I tried the recast graph and it does not cover the terrain nicely or even close to what the unity’s navmesh surface does. It leaves a lot of holes, some are really big others are not even close to colliders just in the middle of the nothing. I am using colliders to bake it.

I also have 2x2 terrain and the island is places in the middle of the 4 terrains, so I have a lot of unused space “ocean” that I would like to remove from scanning, how do I do that?

Hi

The navmesh does not try to capture the height information for empty polygons, which can sometimes be an issue with large open terrains.
You can make it capture the height information more closely by using tiling (in the recast graph settings there is one option called ‘use tiles’).

it should not leave holes though, perhaps the navmesh is rendered behind the terrain?

I think its under the terrain because its only visible when I zoom in and not visible from below. I have use tiles checked but it still appears

Do you think you could post a screenshot?

Note that the reason the terrain is not followed well is because it is not necessary for pathfinding. Pathfinding only cares about if it is possible to walk there, not what the y coordinate is. It can be problematic if the difference is too large as then the nearest node queries might get inaccurate, but otherwise it shouldn’t be a problem.

Here is a pic from above - https://i.imgur.com/4cF8I05.png

Ok.
Yes I can see the navmesh behind the terrain.

It’s not very well visible with your textures though. If you want to see if more clearly you can adjust the ‘Opacity Behind Objects’ color setting in A* Inspector -> Settings -> Colors.

Here is another image with opacity set to 1 https://i.imgur.com/XQykdtZ.png

What does that mean and why its below the ground?

Representing the navmesh with the same resolution as the terrain would be incredibly wasteful and would make pathfindign a lot slower. Even with Unity’s navmesh system they separate it into one navmesh and one height mesh. The height mesh has more accurate y coordinates but is not used for pathfinding directly while the navmesh has a much lower resolution (more like the one this package uses).
Agents should still be able to navigate over those regions just fine.

Okay so about my second question is it possible to shrink that white box and remove the unused blue space - https://i.imgur.com/OVfwqI4.png

Hi

Yes, simply adjust the size in the recast graph settings:

Okay that worked, now the last question about baking, how to bake places like this beach I set the max slope to 90 but cant go higher and it still doesnt bake - https://i.imgur.com/J7Bsf9X.png

Hi

You might have to increase ‘Walkable Climb’ setting. Currently there is no UI warning if the walkable climb value would conflict with the slope value unfortunately.

Okay. I think some of the colliders are taking way too much space when baking the unwalkable area. I have fences that take 5 times more than they should be

The surface of the navmesh is the space where the center of the character should be able to be, therefore the surface is reduced by the radius of the character. You can set the radius of the character using the ‘Character Radius’ setting.

Yes this should work but some characters may be bigger than others if you have animals on 4 legs and then humans

Also I dont know if you have seen the navmesh modifier volume but its really good and you dont have to place invisible colliders + RecastMeshObj, then deactivate these invisible objects every time after baking (which judging by its name it makes me think that it only works for Recast graphs)

Take a look at this tutorial: https://arongranberg.com/astar/docs/multipleagenttypes.html (note that this requires the latest version: 4.1.11 if you want to do it from the inspector, however earlier versions work too, but then you have to configure the graph mask from code).

NavMeshModifierVolumes are indeed very useful. I have a development branch with a partial implementation of a similar solution, however it is not ready for release yet.

Isn’t that a bit of an overheat to use 2 graphs for 2 agent types? Can we just have 1 graph with as close as possible baked navmesh and each agent to define it’s radius

That is very hard to do. What if there is a gap between two obstacles which one agent can pass through and another agent cannot. A navmesh would have to be generated between the obstacles, but then the larger agent would have to dynamically detect where it couldn’t move. This is possible, but it adds a ton of complexity and runtime cost.
Having multiple recast graphs mostly has a memory overhead unless you want to update it during runtime, it does not slow down pathfinding.
AFAIK this is also what Unity does with their multiple agent types.

Okay. One more thing, while reading the script - GraphUpdateScene it says that shift+alt+click removes a point, but it does not and nowhere in the docs I can find how to do that, I can only add the points