Support Forum

Tag path restriction on PointGraph

Hello,

I’m currently struggling to correctly setup the behaviour I’m looking for, and I think I may have misunderstood how to correctly setup Node Tags on my PointGraph.

The setup is as following:

  • A PointGraph with some Node (they are all children of the root transform I set in the data, nothing wrong here)
  • They are all connected, no worries on that side too (from Scan)
  • I have setup some Tags, namely “Road” and “Sand”.
  • On project startup (and after Scan) I iterate over all node, and depending on their type, I set them some tag as following:
for (int i = 0; i < graph.nodeCount; ++i)
{
    var node = graph.nodes[i];
    if ( /* Some computation to check if node has road */ )
        node.Tag = (uint)(1 << AStarTag.Road); 
   else
        node.Tag = (uint)(1 << AStarTag.Sand);
}
  • Tags are setup like this in the AStar component
    PrtScr capture
  • And are defined as following in the code
public static class AStarTag
{
    public static readonly int Road = 0;
    public static readonly int Sand = 1;
}

And then, my Seeker component is as follow:
PrtScr capture_2

But when I try to construct a path:

var path = ABPath.Construct(from, to);
path.enabledTags = _seeker.traversableTags;
path.tagPenalties = _seeker.tagPenalties;
path.nnConstraint.constrainDistance = false;

_seeker.StartPath(path, callback);

I have the following error message from the callback:
Couldn’t find a node close to the start point

The thing is the node is correctly tagged, so I was wondering if I have an issue with how I setup my tags or if I misunderstood something ?

Thanks !