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.
Options

Is it possible to use a World Anchor as a positional marker

Hi,
I would like to store the information of the world coordinates (latitude, longitude) of a spot of a given room and be able to retrieve it when the app is run again. Is this possible by using a world anchor.
The ideal situation would be, if i could trigger an action when the spot in the room is recognized by the hololens and use the world coordinates associated with the world anchor.

Best Answer

Answers

  • Options

    From what I understand, a world anchor won't be the actual marker object.
    1. Create a game object for your marker.
    2. Place it where you want the marker to show up.
    3. Attach a world anchor to it.
    4. Next time you load the app, load the anchor from WorldAnchorStore and attach it to your marker object. If the world anchor is located (found/recognized in the environment through spatial mapping), it will show up in the same place again.

    On the marker object itself, you can attach a script with any information you want, including world coordinates. I don't think the HoloLens has GPS, so you probably have to place the object manually. Maybe look at TapToPlace.cs in the Academy examples.

    Note: Emulator and device have different anchor stores. Also, redeploying the app may wipe your anchor store, so you'd have to save the anchor again.

  • Options

    Thanks for your answer DeanWinch.
    Is there any trigger, when a the world anchor is found/recognized in the environment?

  • Options
    james_ashleyjames_ashley ✭✭✭✭

    @Hen_Solo The world anchor / spatial anchor is something you create, save and assign as needed in your app. You wouldn't accidentally find it or recognize it in your environment. This overview might help: https://developer.microsoft.com/en-us/windows/mixed-reality/coordinate_systems

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

  • Options

    Yes I know, may be I have not formulated my question well. I meant if there is any trigger if the hololens recognizes a spot in the real world where the spatial anchor belongs to

  • Options
    Peter_NZPeter_NZ ✭✭✭

    @Hen_Solo

    The answer is yes. We have done a POC application that does exactly what you are asked. It was a UWF application that you could set anchors against items. Then when you move within 2 meters of those items it would say ("Near Item 1", "Near Item 2" etc).

  • Options
    james_ashleyjames_ashley ✭✭✭✭

    @Hen_Solo You can attach your spatial anchors to other unity game objects. Then put the proximity logic on the game object itself. Meanwhile, the spatial anchor makes sure that the game object with your proximity logic is always placed in the same location.

    For your proximity trigger, you would use something like this (I'm doing this from memory so be sure to double check it):

     if( Vector3.Distance( Camera.main.transform.position, targetObject.transform.position) <= minDistance ){
        // triggered code goes here
     }
    

    James Ashley
    VS 2017 v5.3.3, Unity 2017.3.0f3, MRTK 2017.1.2, W10 17063
    Microsoft MVP, Freelance HoloLens/MR Developer
    www.imaginativeuniversal.com

  • Options

    Yes @stepan_stulov , that looks good :-) . Thank you all

Sign In or Register to comment.