Bug?: GraphUpdateScene + NavMeshCut (node tag is lost)

Hi,

I recently added some dynamic NavMeshCuts to one scene of our game which uses A* pathfinding with Recast Graph. Now I got a bug report that the tag penalties are ignored. Took me a while to realize that the NavMeshCuts are causing the issue. So each time a cut is activated / moved my node tags (made with GraphUpdateScene) seem to be reset / wasted.

How could I automatically reapply the tagging when the graph changed due to NavMeshCut? Or is this a bug (using 4.3.29, also happened with 4.3.28)?

Best regards
Bennet

EDIT: Just found this thread GraphUpdateScene not updating Tag and Tag display problem and the author seems to have the same problem (last post).

1 Like

Hello,

Yes, unfortunately this is the behavior I also observed. I assume this is due to the tile being rebuild when you make a mesh cut close by.

You can try to disable tiles for reycast graph, see if it helps.

Thanks for your answer. Unfortunately “Dont Use Tiles” does not help :frowning:

Not sure about the cost, but a simple reapplying the GraphUpdateScene on NavMesh Change would also be fine for me. But not sure about performance and where to hook into.

Hi

This is by design, but unfortunate.
The reason is that when a navmesh cut modifes the navmesh then triangles can change arbitrarily. There is no guarantee that the previous triangles in the navmesh will line up with the new ones. What happens if two triangles have different tags and are then merged when a navmesh cut is removed for example?
Thus I have taken the approach of just clearing the tags of all modifed triangles.

What you can do is to subclass the NavmeshCut class and then override the UsedForCut method.
That method will be called after a navmesh cut has been used to cut the navmesh. So inside that method you could schedule a new graph update which re-applies the tags.

2 Likes