- A* version: 5.3.5
- Unity version: 6000.0.47
Hi, please I need implement some tags in my gridGraph, I already do that, but I want implement path search via scripting that take in account those tags, what is the right way?
Also, here is a way to set some tag like no walkable? to avoid consume compute.
Some tutorial that explain all about search path and tags via scripting? I see some tutorial on youtube from Aron, but all is via editor/hispector configuration, and the documentation about tags
Thanks so much!
Try to implement the system while I get response from you, I found this:
Also I want suggest an implementation of this methods:
May be can be useful to update tag on big areas
I was implementing the tag system with the following goal:
On the map, there are unwalkable cells, such as natural obstacles, cliffs, etc. These are marked as non-walkable. Then, I assign a specific walkable
tag to the cells that can be walked on. I do this to later detect whether enemy buildings are blocking a path.
I thought that if I used the following NNConstraint
:
nnConstraintToSearchUnits = new NNConstraint
{
constrainWalkability = false,
constrainDistance = false,
constrainTags = true,
tags = (int)tmpTagWalkable
};
the algorithm would search through all nodes with the walkable
tag, and then I could run a loop like this:
foreach (var tmpGraphNode in tmpABPath.path)
if (tmpGraphNode.tag == buildingTag)
to check if a building was obstructing the path. But I just found out that the path isn’t even calculated through buildings, because they mark the nodes underneath them as unwalkable.
I assumed that by setting constrainWalkability = false
, the search would include both walkable and unwalkable nodes, and the filtering would happen based on the tag only — but that’s not how it works.
Is there a solution for this? I need to calculate paths that go through nodes marked as unwalkable, but still use tags to identify what’s present at each node in the path.
Thank you very much!