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

Keeping GameObject In Same Position When Changing Scenes

ChiChaChiCha
edited May 2016 in Questions And Answers

Hello,

We're currently developing a music app called KeyboARd that helps users learn to play the piano.

We've made it so that we can place a piano keyboard with the HoloLens, but we're stuck with trying to keep the keyboard in place in the same position.

In Unity, we've created an script that would save the keyboard's position before we switch scenes and then when we switch scenes we would re-position our keyboard, however we soon realized that the position saved is relative to where the HoloLens is facing.

Are there any ways that we can keep keep the keyboard in some absolute position or some other way to keep the keyboard in the same position when switching scenes?

Thank you!
Josh

Best Answer

Answers

  • Options

    Do you need to delete the keyboard and recreate it?

    You could use:
    http://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html

    And just keep the keyboard in the scene. Perhaps set inactive if you need to show something else while loading and then reactivate it?

    Taqtile

  • Options

    We've tried DontDestroyOnLoad() too, but we also got the same problem. The keyboard always moves to the relative position of where the user is looking when we transition to a new scene.

    At this point the only thing we can think of is to put everything in one scene.

  • Options
    edited May 2016

    Perhaps you could try playing with the Sharing.unity test scene in the HoloToolkit-Unity. Idea would be to create a World Anchor and save it off. Your piano would be relative to that world anchor. Then when you transition to a new scene you first download the anchor and snap the Piano back into the same relative position. We teach this concept deeper in the Shared Holograms academy as well. Hope this helps.

  • Options

    @ChiCha I just accomplished this scenario with World Anchor Points - just watch out for any "static" gameobjects.

    Healthcare IT professional by day - Indie GameDev for UWP and mobile platforms by night

  • Options

    @ChiCha I have the same problem with you. Did you solve the problem with World Anchor? Thanks!

  • Options

    Use the world anchor store to save your points and load them between scenes. Only watch out to remove the anchors from the game object as you move them and add them back when done moving.

    http://www.redsprocketstudio.com/
    Developer | Check out my new project blog

  • Options

    @jbienzms
    Is that possible to provide a working sample on this approach? I believe this is actually better approach even than the Galaxy Explorer method.

  • Options

    @Karthik I'm not aware of a sample off the top of my head, but the TapToPlace behavior has pretty much all of the code you need built-in.

    Our Holographic world is here

    RoadToHolo.com      WikiHolo.net      @jbienz
    I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

  • Options

    Thanks @jbienzms.

Sign In or Register to comment.