How to use tagMask

How is working tagmask and how to use in function PathUtilities.GetReachableNodes ?



Tagmask is a bitmask, each bit representing a tag.

Also, here is a nice explanation for the graphMask used in other parts of the system (works in basically the same way, just with graphs instead of tags):

PS: Sorry for the delay, I have been away for a while.

I know how bitmask work. I don’t understand how use it for GetReachableNodes.
For example:
I create GridGraph with mask parameter in “collision testing” two layer Default and MyLayerName.

How I can use GetReachableNodes only for one layer mask?? only Default ?


The mask in collision testing is a layer mask, it will not create different tags based on what layers the objects are in. However that is a good idea, I should investigate that.
You need to create tags in some other way (see docs on how to use tags).

OK. I create different tags on GameObject with box collider.But in function
//Below code from PathUtilities.cs

callback = delegate (Node node) {
				if (node.walkable && ((tagMask >> node.tags) & 0x1) != 0 && map.Add (node)) {
					list.Add (node);
					stack.Push (node);

but node.tags always = 0 . How i can set tag for node?

Or how to GetReachableNodes for second GridGraph ?

I understood :slight_smile: I create second GridGraph with needed layer mask and use GetReachebleNodes with this node

`NNConstraint nnconstraint = NNConstraint.Default;
nnconstraint.graphMask  = 1 << 1; 

Node[] availNodes = PathUtilities.GetReachableNodes(,nnconstraint).node,-1).ToArray();`

Thanks for your help.