Path not generating for tags - 4.2.17

Hello, when I click a path and the position is on top of a non-traversable tag it doesn’t generate a path at all. I would like to use the partial path but because it doesn’t calculate, I can’t get the partial.

I notice that periodically, it will create a path when I click on a tagged object. But, 95% of the time it doesn’t.

Hi

Tags are a bit tricky for the pathfinding system. Essentially, what it tries to do is “find the closest node to the destination point that I can reach, and then search for a path to that node”. The problem with tags is that it cannot always determine if a node can be reached efficiently or not. This means that, yes, it can generate the path you want in this case, but it will be inefficient since it will have to search a large part of the graph to be able to determine that it is indeed the best path. So it is opt-in. You can enable this by setting the path.calculatePartial field to true. I’m not sure which movement script you are using, so I can’t tell you exactly how to set this field. But that’s the gist of it.

I am using the AI Path script. I did try the calculatePartial = true before posting here. The behavior is; I click the position and it immediately clears the list of position to get to the point. I can see it render the gizmo to the location very briefly but before I can do anything with the list, it has already been cleared. I’ve tried cloning the list and whatnot but it’s gone immediately after the set destination if the position is on top of a tag.

The behavior using colliders is different. I can use the get partial path from that. But, I don’t want to use any colliders on the tilemaps since they cripple performance.

Players can mine each tile, chop trees, etc. so each time that happens it would have to recalculate the colliders. Can be 1000s of tile changes per minute. Spikes it out to 1000ms every time there’s a single change :smiley: The tags are perfect replacement for colliders in this situation since I can do a 1x1x1 bounding box of the tile to add/remove them all day long without any performance impact.

Hi

Are you using a built-in movement script? If so, you may want to disable the agent’s own pathfinding calculations to prevent it from overwriting your own.

See IAstarAI - A* Pathfinding Project

No, players are allowed to click once per second to move to different locations using the AI Path Set Destination. There are no other sources of pathing other than that click on each client.

I will take a look at the set path. That looks promising.

Thank you kindly for your time!

1 Like