rhylvin2019
rhylvin2019

Reputation: 63

How to manually disable/enable mrtk v2 spatial awareness settings

I'm trying to manually enable or disable the spatial awareness of my HoloLens app.

I have this UX hologram that is relative to my position (and it follows as I move) that I need to interact with, but colliders that were made from spatial awareness-mesh observer due to real walls will block the UX holograms hindering me from interacting with them.
I could just move away from the wall so I could interact the UX holograms but enabling them or disabling them would be more professional.

I need the spatial awareness-mesh observer to be enabled so I can create holograms using collider, but I also want them to be disabled so I can easily maneuver and interact with my UX hologram.

I'm pretty sure we can just enable or disable the Spatial Awareness System, but I'm having a hard time researching the syntax of getting the Spatial Awareness System in order to manually enable/disable it.

Upvotes: 3

Views: 3904

Answers (2)

Will W
Will W

Reputation: 81

So I think there are a few toggles here that are available, which I think Hernando addressed as well.

If you want to:

1) Totally disable the spatial awareness system (i.e. no meshes, no colliders, nothing)

Then following the code in the first half of this answer would do it for you: Enable/Disable Spatial Mapping at runtime in MRTK2

2) Have meshes, but just no rendering of the meshes:

https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/SpatialAwareness/UsageGuide.html#hiding-the-spatial-mesh

Upvotes: 2

Hernando - MSFT
Hernando - MSFT

Reputation: 2900

If you would like to enable or disable the collision of the spatial awareness mesh, you first need to access the Meshes property of observer(To get the Observer, you can refer to the second code in this answer: Enable/Disable Spatial Mapping at runtime in MRTK2 ), and then access the Collider property of the mesh object, which property is an instance of the MeshCollider class. Finally, you can enable/disable the collider with enabled property.

Upvotes: 1

Related Questions