The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
Shift operator used in SpatialMapping.cs
Why is a shift operator being used in the Awake method? all it is doing is setting the PhysicalRaycastMask to int.MinValue, and why use shift as opposed to a int.MinValue?
Best Answer
-
ahillier mod
We bit shift the index of the spatial mapping layer (31) to get a bit mask, which will allow us to cast rays only against colliders in the spatial mapping layer.
LayerMasks do not have to be limited to a single layer. You can combine multiple layers to cast against. For example, we could do something like this to combine layers 31 (spatial mapping) and 5 (UI) together:
var layerMask = (1<<31) | (1<<5);
The answers to these Unity posts are great and should help explain further:
http://answers.unity3d.com/questions/177206/raycasting-and-layermask-question.html
http://answers.unity3d.com/questions/122586/layermask-vs-1ltlt-gameobjectlayer-.html1
Answers
We bit shift the index of the spatial mapping layer (31) to get a bit mask, which will allow us to cast rays only against colliders in the spatial mapping layer.
LayerMasks do not have to be limited to a single layer. You can combine multiple layers to cast against. For example, we could do something like this to combine layers 31 (spatial mapping) and 5 (UI) together:
var layerMask = (1<<31) | (1<<5);
The answers to these Unity posts are great and should help explain further:
http://answers.unity3d.com/questions/177206/raycasting-and-layermask-question.html
http://answers.unity3d.com/questions/122586/layermask-vs-1ltlt-gameobjectlayer-.html
Thanks for the answer!