Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. 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.