ConstantPath ignore penalties

Hi, I have a problem that seems really simple but I can’t seem to find a solution. How can I construct a ConstantPath which ignores penalties and non-traversable tags? My ConstantPath is able to ignore non-traversable tags now but it cannot ignore penalties.

My code:
ConstantPath constPath = ConstantPath.Construct(Currentplayer.transform.position, 6000, null);
yield return StartCoroutine(constPath.WaitForPath());
GridNodeBase[] nodesToContourAll = constPath.allNodes.Cast().ToArray();

My first thought, probably a suboptimal/naive way of doing it, would be to create a separate navmesh/grid graph/whatever without the penalties and tags, and have the agents that need to avoid the tags use that graph.


You can use a custom ITraversalProvider for this.
See Utilities for turn-based games - A* Pathfinding Project

Works like a charm :+1:

1 Like