- 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!
You may want to try not setting the ground under the buildings to walkable, but instead simply tag the ground they are built on and check for that tag along the path, maybe using something like this.
This would fix this issue, letting you search the path through the buildings. I’d have to double check this interaction but I’m pretty sure you could use that NNConstraint to basically make the area selectively unwalkable if you omit the tags with buildings on them.
I can’t setup the ground under buildings like walkable, because the RVO systems colliders again that buildings if I remove this, the units start to move inside of buildings when the crow positions is calculated
Do you have Hard Collisions turned on in your RVO Controller?
Hi
It is indeed a bit confusing right now, because there are two possible places to set the tags for a path. I’m right now working on some updates to make that less confusing.
What you should do is:
path.enabledTags = myTagMask;