A* Pathfinding Project

[Bug?] Deleted connection after NavMesh Cut


#1

Hi,
I had a recast graph, connected to Point graph (not using Links, i added connection by script). When I use NavMesh Cut to remove some area from recast graph, connections to point graph are being deleted. Is it correct behaviour, or it it a bug, as i could not find what should happen there.

To be more specific, I am using 4.2.3 version. The only connection that gets deleted is connection from recast graph to point graph. (There still exists a connection from point graph to recast graph. Furthermore due to this connection, this two graphs are considered same area)


#2

Hi

If you are adding links using a script directly they can unfortunately not be preserved when using navmesh cuts. The reason is that navmesh cuts can change the navmesh pretty much arbitrarily and so all nodes inside a tile have to be completely rebuilt, if a node had a connection to a node in another graph it is impossible to know which node that the connection should connect to among the rebuilt nodes. In simple cases one could use a heuristic to solve it, but in general it is not really possible with the information that the package has at that stage. What the included components (e.g. NodeLink2) does is that every time a graph is updated, they rebuild all the links if the start or end node has been changed.
The connection (in both directions) should be kept if the node did not change at all compared to before the navmesh cut update. I’m not sure if this is the case for you. I’m not sure why the connection from the recast graph to the point graph is kept if the node stays the same though… That might be a bug.