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.
Do you need both Unity Spatial Mapping Renderer and SpatialMapping Prefab
I'm a little unclear as to how these two related. Are they mutually exclusive or do you need both? If both, what does the Renderer do that the Prefab doesn't?
Best Answer
-
Optionsahillier mod
@gene,
No, you should only use one of the provided solutions (Unity components or HoloToolkit prefab). Both will create and interact with a SpatialMappingObserver object which can get the environment information from the HoloLens. You only want one Observer running in your application.The SpatialMappingCollider and SpatialMappingRenderer components are relatively new to Unity. They can be used separately, so if you don't care about physics, you don't need to add a SpatialMappingCollider to your gameObject. This can save a bit on perf.
The SpatialMapping prefab was created before the SpatialMappingRenderer and SpatialMappingCollider existed. It creates a gameObject with a collider and renderer to represent each mesh found by the SpatialMappingObserver, and keeps them updated as the environment changes. It also provides several methods that make it easy to access the underlying meshes (which you need for processing). Many of our classes and HoloToolkit components were built with this prefab. While we do have plans to update the other HoloToolkit components (planeFinding, spatialUnderstanding, etc.) to work with the newer Unity components, there is no set timeline for this work to be completed.
6
Answers
You usually need one game object in your scene that has one SpatialMappingCollider component and one SpatialMappingRender component attached to it.
SpatialMappingCollider is being fed a mesh from the depths of the HoloLens and acts as a usual Unity's collider. You can have your cubes fall onto it. You can change some properties of this component like freeze mesh update or disable the component altogether.
SpatialMappingRenderer renders a mesh that is being fed to it in the same way as with the SpatiamMappingCollider. You can change some properties of this component like freeze mesh update or select different rendering modes like whether or not the spatial mesh should occlude your other stuff etc.
Now whether or not that game object is an instance of a prefab or done anew is up to you.
There may also be a SpatialMapping component that, if I may speculate, confused you. That script comes from the HoloToolkit and is merely a wrapper around the SpatialMappingCollider and SpatialMappingRenderer, it introduces nothing conceptually new, just a convenience.
I think there is generally a confusion about what parts are pure Unity's APIs for HoloLens and what are C# convenience tools from the Holo Toolkit written by Microsoft folk. I recommend drawing that line in your head as early as possible
Building the future of holographic navigation. We're hiring.
@gene,
No, you should only use one of the provided solutions (Unity components or HoloToolkit prefab). Both will create and interact with a SpatialMappingObserver object which can get the environment information from the HoloLens. You only want one Observer running in your application.
The SpatialMappingCollider and SpatialMappingRenderer components are relatively new to Unity. They can be used separately, so if you don't care about physics, you don't need to add a SpatialMappingCollider to your gameObject. This can save a bit on perf.
The SpatialMapping prefab was created before the SpatialMappingRenderer and SpatialMappingCollider existed. It creates a gameObject with a collider and renderer to represent each mesh found by the SpatialMappingObserver, and keeps them updated as the environment changes. It also provides several methods that make it easy to access the underlying meshes (which you need for processing). Many of our classes and HoloToolkit components were built with this prefab. While we do have plans to update the other HoloToolkit components (planeFinding, spatialUnderstanding, etc.) to work with the newer Unity components, there is no set timeline for this work to be completed.