Tag penalties not working

I have 2 terrain tags, “Basic Ground”, and “Path”. I have a U shaped path where the start and ends are at the ends of the U, so the physical distance is much shorter if you can walk directly across. I want to force the units to move along the path when possible but not prevent them from off the path sometimes. I have a GraphUpdateScene on each tile with the tag set to Path. In my seeker I set the only 2 valid tags to “Basic Ground” and “Path” and I set the tag penalty for Basic Ground to 100. The path is much shorter than 100 units, so it should be chosen as the shortest path, but the units will always cross directly across. I have tried, 1,000, 10,000, etc. and there is no difference. I can force a seeker to use the Path by setting that as the only valid tag so I know the entire distance is traversable via only path tagged objects. So what gives, why is the tag penalty being ignored here?

Hi

Since all penalties are integers, a scaling factor is used. Traversing 1 world unit corresponds to a cost of 1000, so you need quite large penalties to make a difference.
It is of course possible that there is some bug that is causing it to be ignored, in that case, would it be possible for you to create a small test scene which I could use to debug the problem?

I’m trying to a similar thing to @dkoontz, although it doesn’t seem to be working.

I’m curious about the tagging. Are the tags specified in seeker module the same tags used on a GameObject or do they need to be created using Graph Update Scene component?

Hmm, that’s a bit confusing. Does A* Pathfinding have it’s own tags or does it use Unity tags, as seen in the GameObject Inspector?

So for example, I have selected the road collider objects and set their Tag to road, which did not seem to do anything. So I add a Graph Update Scene component to the same road collider objects and set the Modify Tag to Road, and a Penalty of 5000. No noticeable change in behaviour.

Hey,

A* has it’s own tag system.
You can find them under Settings > Tag Names

You can read more about the tags here:
https://arongranberg.com/astar/docs/tags.html

1 Like