Door - Tags not changing

I have a 3D scene with a Recast Graph and a single agent.
The agent’s pathfinding works so far - it roams around randomly.

But the agent obviously does not care for closed doors.
I tried to implement that using tags (used the Door example as reference):

  • Added a BoxCollider surrounding the door, called _navMeshRecalcCollider.
  • Added new tags to the Seeker of the agent (Tag 1 = door open, Tag 2 = door closed).
  • Tag 2 is marked as not traversable.
  • When door is closed, this code is executed:
            GraphUpdateObject guo = new GraphUpdateObject(_navMeshRecalcCollider.bounds);
            guo.modifyTag = true;
            guo.setTag = _closedTag;
            AstarPath.active.UpdateGraphs(guo);

However, the agent still ignores the doors.
Also, when I set debug colors for the new tags, and set Graph Coloring to ‘tags’,
the tags surrounding the door always stay grey (default tag).

What else could I try? Do tags work for Recast Graphs?

Would RVO be an alternative if I can’t get tags to work?

Hi

It’s possible that your bounding box just doesn’t cover the center of any nodes.

On recast graphs that can become an issue. You can find more details about how to solve it here: RecastMeshObj - A* Pathfinding Project

Thanks for the info - I made sure the collider fully covers some nodes, but
the tags still won’t change.

Should this work to manually change node tags:
AstarPath.active.data.GetNodes(node => node.Tag = 2);
If I iterate the nodes after this, then all nodes changed their tag to 2.
But the debug color of the nodes does not change, and the AI does not
honor the new tag 2 (which is set to not be traversable).

Is there any setting in the AStarPath object that would disable tags or not allow them
to be changed?

Oh. If you want to modify node properties you should probably set guo.updatePhysics = false, otherwise it will recalculate the whole tile.

Edit: I switched to Local Avoidance for the doors, and it works nicely! :slight_smile:

1 Like