Calculated paths are not influenced by graph tags when certain modifier is set

I’ve stumbled upon few issues related to graph tags.
I use tags to restrict navigation in some areas for certain types of characters on Recast Graph.
It works correctly most of the time, but does not in particular conditions so it seems like internal bug rather than configuration problem.

  1. Tags are not taken into consideration entirely when RaycastModifier is used along with the useGraphRaycasting flag set to true. This situation is pretty clearly explained on included screenshot.

This is how enabled tags are applied before path calculation

            var path = ABPath.Construct(start, to, callback);
            path.nnConstraint = nnConstraint;
            path.calculatePartial = true;
            path.traversalProvider = null;
            path.maxGScore = null;
            path.enabledTags &= ~(1 << prohibitedTags);
            AstarPath.StartPath(path);
  1. Tags are cut off from recast graph when part of the graph with marked tags is recalculated, eg. by GraphUpdateScene component (with updatePhysics set to true).
    I 've debugged this issue and it worked out that when recalculating tiles, old tags are just not rewritten to new tile. This is fix I’ve made which is working for me so I post it for inspiration, but this issue should be resolved as soon as possible in the main package.
  1. I believe this has been fixed in the beta version.

  2. Yes. Unfortunately there is no proper way to fix this. There simply is not enough information about which nodes should have which tags when the whole topology of the graph changes. I usually recommend not to use both navmesh cutting and tags at the same time because of this.

I am using latest beta 4.3.42 and this is still happening, tags with penalties are completely ignored (Grid Graph)

Without RaycastModifier:

With RaycastModifier:

(The wall palisades have tags, AI cost for them is like 500 000)

Version proof:

image

Ah, no you are right, sorry. I mixed it up with the simplification step for the RichAI (which also uses a kind of raycasting). Right now the RaycastModifier will ignore penalties. It will take tags into account, but only if they are traversable or not. I suppose one hack you could do is to modify the RaycastModifier slightly to make it believe that all of those tags with penalties are actually not walkable. That will prevent it from simplifying the path over any barricade nodes (if the path actually goes over some barricades it will just leave those as is).

The simplest way I can think of doing this (note that this is not tested) is to add this to the RaycastModifier script:

@aron_granberg but I need the AI to go over barricades if there is no other path. Otherwise I would have marked those barricades as not traversable :frowning:

I believe your suggestion will ignore cost and make the AI stuck, since path will be unwalkable to the destination. But I will try it anyway and let you know! Thanks!

Actually it will work just fine (I think). It’s only the RaycastModifier that thinks those nodes are unwalkable. This means any attempt to simplify the path which involves those nodes will fail, so the modifier will skip simplifying that part. It will leave the part of the path that passes over the barricades intact.

@aron_granberg Is there going to be a definitive fix to modifiers not working with tag penalities? The hack you posted on april works but it would be nice to have the mentioned features behave as intended out of the box. It took me a while to even find this thread lol. The previous threads about this topic suggest you only have to use the latest beta version but that didn’t do the trick for my issues.

Thank you.

Currently, there is no fix for it. I have some plans for a proper fix, but my todo list is quite long I’m afraid… :confused: