How to use tagMask

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

Up!

Hi

Tagmask is a bitmask, each bit representing a tag.
Wiki: http://en.wikipedia.org/wiki/Mask_(computing)

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): http://arongranberg.com/astar/docs/class_pathfinding_1_1_n_n_constraint.php#a63a785ae519f012d295916dd9969170c

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 ?

Hi

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
GetReachableNodes
//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(AstarPath.active.GetNearest(transform.position,nnconstraint).node,-1).ToArray();`

Thanks for your help.