Proper way of setting areaMask int using code

I’m trying to calculate a path specifying an areaMask I can’t seem to make any sense of it.

Using AllAreas works fine:

NavMesh.CalculatePath(transform.position, targetObject.transform.position,NavMesh.AllAreas, path);

If I have the following Areas set up, how would I specify the use the area “Road”?

If I manually set the area mask to “Road” and query it the int value is 16 but I don’t understand how this is derived.

Any help?

I searched for documentation but did not find anything.

Thank you.

3393302--266838--Capture.PNG

If you’re just asking why it’s 16, it’s because of the mask. 2^4 = 16, in your example.
Is that what you wanted to know?

In this case what does the 2 and the 4 represent?

Oh I see, it’s binary, reading from the end of the area mask list.

010000, which is 16.

Thank you.

Yes, sorry :slight_smile: Maybe I should have added that. heh.