Hello everyone.

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.

World anchors and space tracking state questions

Hi,

I'm trying to create a Hololens app, and am currently working on properly implementing world anchors, and their relation with the space they are placed in.

I'm trying to catch the possibility that the Hololens Space finishes loading after the app started, but doesn't match any previous scanned data. I've found that when deleting the only Space we're using in the Hololens settings menu, the World anchor remains, and can't be located anymore, because its data is lost.

Is there a way to get the state and id of the current Hololens space, and an id of the space the World Anchor I'm controlling resides in?

I'm using Unity 5.6 with HoloToolkit for my project, and do my tests on the developer HoloLens.

Thanks in advance.

Best Answer

  • edited November 2017 Accepted Answer

    Great question. The recommended approach here is to store a “canary” anchor for each logic "space" the app cares about (e.g. different rooms or locations), and test its locatability against a SpatialStationaryFrameOfReference (i.e. Unity's world coordinate system) to determine which space the device is currently tracking in (with some allowance for taking time to relocalize). There's nothing currently exposed in the platform to directly reason about which space is being tracked. The only relevant API in the case you described is the RemovedByUser property on the SpatialAnchor which will be set to true when the user has explicitly deleted the Space from the settings page. It looks like Unity may not surface that property directly on their WorldAnchor object, but you can use GetNativeSpatialAnchorPtr to "punch through" to the native platform API and access the property that way if necessary.

Answers

  • edited November 2017 Accepted Answer

    Great question. The recommended approach here is to store a “canary” anchor for each logic "space" the app cares about (e.g. different rooms or locations), and test its locatability against a SpatialStationaryFrameOfReference (i.e. Unity's world coordinate system) to determine which space the device is currently tracking in (with some allowance for taking time to relocalize). There's nothing currently exposed in the platform to directly reason about which space is being tracked. The only relevant API in the case you described is the RemovedByUser property on the SpatialAnchor which will be set to true when the user has explicitly deleted the Space from the settings page. It looks like Unity may not surface that property directly on their WorldAnchor object, but you can use GetNativeSpatialAnchorPtr to "punch through" to the native platform API and access the property that way if necessary.

  • @dfields_msft said:
    The only relevant API in the case you described is the RemovedByUser property on the SpatialAnchor which will be set to true when the user has explicitly deleted the Space from the settings page. It looks like Unity may not surface that property directly on their WorldAnchor object, but you can use GetNativeSpatialAnchorPtr to "punch through" to the native platform API and access the property that way if necessary.

    That definitely solved the space deleting problem, thanks!

Sign In or Register to comment.