0
Answered

Invert a layer mask?

NeedsLoomis 6 months ago updated by Lazlo Bonin (Lead Developer) 5 months ago 2

We can make a list in bolt and create a mask with LayerMask.GetMask, but how do we invert the mask?  We could use the function tool and stuff like  "~(1 << mask), but its a bit cumbersome for non coders.

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
i dont know situation / but maybe its possible to use few layer mask literal  or values get set to invert

for example nothing is  0 /  everything  is 16183 or just to use second layer mask literal 

picture to show graphs- not invert flow


Answered

In Bolt 1, unfortunately, there are no bitwise operator nodes. Using a helper C# function is the only method.

In Bolt 2, you could use the bitwise operators on LayerMask.value directly.