I applied mask1 for planes that construct maps and then using Physics.Raycast(ray, out hit, 1000, mask1) I know if it hit the right layer. On the other hand I want to apply mask2 to some of that planes for Pathfinder from Aron Granberg. But I cannot apply multiple layers for the same object. What I should do?
Phy.raycast(.., mask1 | mask2) will hit anything selected by mask1 or 2. Or, you can make the mask directly. Say you want to hit layer 8 and 12 – int layer8n12Mask = 1<<8 | 1<<12;
If you need the ray to hit all of 8, but only some things on 12 (the ones you wanted to put on 8 and 12,) but not the rest of 12. You have to split them out. Maybe make layer 14 be the “count as 8+12” layer. For pathfinding, you can check 12 and 14 in the list. For ray casts, can use mask8 | mask14.