microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6.01k stars 2.12k forks source link

How do I cache a spatial map? #672

Closed shukenmg closed 7 years ago

shukenmg commented 7 years ago

Like in fragments.

So players don't need to scan their room every time they start my app?

thx

SuperShinyEyes commented 7 years ago

I'd like to know about it too. My guess about how Young Conker game saves spatial map is it would probably save SurfaceIds to the disk and load them later. But how do you then judge whether this spatial map data is still relevant or not?

SuperShinyEyes commented 7 years ago

Actually there's an example: https://github.com/Microsoft/HoloToolkit-Unity/tree/master/Assets/HoloToolkit-Examples/SavingSpatialMeshes.

shukenmg commented 7 years ago

Yes but how does it work?

christjt commented 7 years ago

This happens automatically doesn't it? When querying the spatial mapping / scanning, the application seemingly looks at the OS level spatial map(space). So if this is already scanned it should almost instantly finish scanning the second time your try (given that you do not change wifi and/or delete the space from settings). At least that is how it works for us.

shukenmg commented 7 years ago

Well it works like that when you use the Spatial Mapping prefab, but when you use the Spatial Understanding prefab then it does a complete rescan every time.

And i found that many games require you to rescan every time too?

Also would it be possible to use Spatial Anchors to anchor the holograms in place then saving them with persistence API then just load the anchor according to the user selection?

Thx

keveleigh commented 7 years ago

@DanTDMMcpe I haven't used the Spatial Understanding prefab enough to comment on that, but your last point definitely sounds like the way you'd want to do it. If there's a way to only run the Spatial Understanding prefab on first boot/whenever the user wants to reset, then you can use that info immediately to place objects in the room either attached to multiple anchors or all relative to a single anchor in the room. Then, next time you load up the app, the anchors should lock in with the space, irrelevant of Spatial Understanding or Spatial Mapping running.

StephenHodgson commented 7 years ago

Going to close this. It's probably been archived by google by now.