Support Forum

Modifying areas/tags/penalties while navmesh cutting


we are currently working on a city-building game and want to add roads that the players can build to reduce travel cost.

I figured the best way to do roads is to cut the navmesh where roads are placed, keeping the inner polygons (isDual-flag) and assigning them a negative penalty or different area (we already cut the navmesh when buildings are placed so this would most likely only fill the area between the buildings an not introduce a whole lot of new geometry).

Assigning a penalty value or tags to those nodes works, but I couldn’t find a way to do this without rebuilding the navmesh/rescanning the graph. Assigning a new area (using RecastMeshObj) didn’t work at all. It just raised the navmesh to be on top of the used collider and the additional cuts were gone, applying the new area to a huge triangle. I couldn’t reproduce the behavior from the tutorial video where new seams were introduced around the object.

So I have three questions, basically:

  • is it possible to assign a penalty without rebuilding the navmesh/rescanning the graph and if so, how?
  • how to do the same thing with areas?
  • if there is currently no good way to do this: would it be possible to get such a feature?

Oh and a fourth tangentially related question: how does cutting the navmesh a lot impede performance on further cuts and pathfinding? And I assume using tiles would improve cutting performance? We are not at a stage yet where we could run performance tests or experience any problems.

Thanks! :slight_smile:

PS: we are currently using version 4.2.17


Sorry for the late reply.

Combining navmesh cutting with tags and penaltieis is very hard because the navmesh can change in ways that make it impossible to keep the tags.
However, you could possibly use the beta version and then use the tag functionality that is not built-in to the RecastMeshObj component. In that case you should avoid all navmesh cutting and just rely on that and regular graph updates.

Using tiles improves performance, yes. Because it only needs to update the tiles which are touching the cut. This applies to all graph updates on recast/navmesh graphs.