It didn’t work for me at all until I implemented the old version you mentioned and used 1<<6 for the layer mask. where can one read more about it? bit shifting you said? (I also saw bitwise now in google search)
So if I use this bit shifting is all the static method and variable are still relevant?
You’re trying to use the layermask in a tricky way? You could do it that way, but why would you? Hard coding in what layers kind of defeats the purpose of having the layermask variable in the first place.
Try MouseWorld.instance.mousePlaneLayerMask instead. I think that is the answer you’re looking for.
You can do that but it makes it hard to read.
Why exactly did the other method not work? The only reason why it wouldn’t work would be if you didn’t assign the right value on the layer mask in the editor, there’s no difference in those two methods. As far as the code is concerned it’s exactly the same thing using a layer mask or bit shifting.
I covered bit shifting in more detail here if you want to learn more Code Monkey - Layers, Layer Mask, Bitmask, Bitwise Operators, Raycasts
hey! what was the error like when you tried the layermask method? make sure you don’t forget to write “instance.mousePlaneLayerMask” and not just “mousePlaneLayerMask”. i almost forgot to properly reference the MouseWorld script and was getting an error as well! Hope this helps!