How to use the direct environment within your app?

6a61796a6179
edited April 2018 in Questions And Answers

Hi everyone,

I was just wondering how to integrate the Spatial Mapping functionality into your own app, where it scans the environment and places holograms, etc. within the specific environment you are using the HoloLens within at the time?

I have been following the tutorials on the Microsoft HoloLens website, where the Spatial Mapping 203 tutorial (https://docs.microsoft.com/en-gb/windows/mixed-reality/holograms-230#chapter-1---scanning) has been very helpful in the fact that the finished version of the Planetarium app uses the exact functionality that I'm trying to integrate for my own app.

I have scanned in my local environment, however I don't think the Planetarium app has to do this, it appears to scan in real-time I think as oppose to using an existing room scan.

To summarise, I want to have the Spatial Mapping features exactly like the Planetarium app, where you can place holograms around the room and the room is your environment and not a pre-defined room like the HoloLens Emulator uses.

Thank you very much for your time and help.

Answers

  • dbarrettdbarrett ✭✭✭

    The existing room scan is only used in the editor and emulator for testing and is not used on the HoloLens. The Spatial Mapping only works on the HoloLens and it only uses the room scan to simulate a room scan on the emulator and editor for easier testing. Just putting the Spatial Mapping prefab into your Unity scene will make it work. If you want it to start automatically make sure that Auto Start Observer is checked and if you want to see the mesh make sure Draw Visual Meshes is checked as well.

    AR Developer

  • Thanks for your reply dbarrett. The Auto Start Observer and Draw Visual Meshes options are checked already however I have scanned in my environment into Unity and have built and deployed my application using that. Do you think if I remove the scanned room that it will automatically detect my environment and if using this scanned room might be getting in the way of letting the HoloLens scan on the fly?

    Thanks again

  • dbarrettdbarrett ✭✭✭

    The scanned room will be overwritten whenever you launch the app on the HoloLens. What is the problem you are having on the HoloLens?

    AR Developer

  • Oh right OK. When I deploy the app from Visual Studio, it loads the scanned room however doesn't map the room exactly. It is based on adjustments made to the scanned room I've loaded into unity where I have changed the main cameras position. This means that currently it is slightly out of alignment with the actual room. I'm using the main camera and not a hololens camera or camera from the holotoolkit. I've noticed these two cameras are available so thought I would mention just in case that was a factor here.

    Thanks

  • dbarrettdbarrett ✭✭✭

    Yes, you need to use a HoloLens camera and the camera has to be at 0,0,0.

    AR Developer

Sign In or Register to comment.