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

Update application placement?

jtthjtth
edited December 2017 in Questions And Answers

When a user opens a Unity Hololens application they are given control over where the application starts by giving them a generic white box to denote the application and allowed to place it any where via the air tap gesture.

Problem:
If a user blooms out of the application but does not close this white box, the application is left in a suspended or 'tombstoned' state. When the application is opened again, the Hololens remembers the old white box placement and reloads the application their.

This isn't desired behavior as with multiple users and or a variety of locations, the application appears to not be loading to the user when the Hololens is bringing the suspended application back into the running state but not updating its position to the current user gaze

Question:
Can one detect, in awake, where the user is looking and move the application manually?

  • UnityEngine.WSA.Application.windowActivated : Fired when application window is activated.
    Somewhere like this?

Any google searches on this question or variations in wording turn up nothing. Unsure of the possibility of moving the app itself.

If this isn't possible would the next alternative be to force the app to close when I want, say for example, in the suspended state? In an attempt to prevent this type of multiple apps open situation.

Tagged:

Answers

  • Options

    Hey, @jtth

    Just to be sure. Are you dissatisfied with the content within your application positioned incorrectly or the (white) application windows positioned incorrectly?

    Just a few quick thoughts:

    There is no read and no write API for the positions of the (white) application windows. None that I'm aware of. It's up to the user.

    If you're dissatisfied with the content within the application not being relative to where you placed the (white) application window: such behavior is never really promised by HoloLens in the first place. You can ensure fixed position to the world with the world anchors and to the user with syncing with the main camera's transform. Anything else is really just a hybrid of the two but certainly isn't dependent on the application window's position.

    Here are a few links on application pausing:
    https://forums.hololens.com/discussion/comment/14363
    https://forums.hololens.com/discussion/comment/14159
    https://forums.hololens.com/discussion/comment/12681

    I'm not entire sure how multiple instances of the same app co-exist.

    Perhaps a Kiosk Mode is something you could look into?

    Or have I misunderstood you question entirely?

    Cheers

    Building the future of holographic navigation. We're hiring.

  • Options
    jtthjtth
    edited December 2017

    @stepan_stulov said:
    Hey, @jtth

    Just to be sure. Are you dissatisfied with the content within your application positioned incorrectly or the (white) application windows positioned incorrectly?

    Just a few quick thoughts:

    There is no read and no write API for the positions of the (white) application windows. None that I'm aware of. It's up to the user.

    If you're dissatisfied with the content within the application not being relative to where you placed the (white) application window: such behavior is never really promised by HoloLens in the first place. You can ensure fixed position to the world with the world anchors and to the user with syncing with the main camera's transform. Anything else is really just a hybrid of the two but certainly isn't dependent on the application window's position.

    Here are a few links on application pausing:
    https://forums.hololens.com/discussion/comment/14363
    https://forums.hololens.com/discussion/comment/14159
    https://forums.hololens.com/discussion/comment/12681

    I'm not entire sure how multiple instances of the same app co-exist.

    Perhaps a Kiosk Mode is something you could look into?

    Or have I misunderstood you question entirely?

    Cheers

    Update:

    void Awake() {
    if(UnityEngine.VR.VRSettings.loadedDeviceName.Equals("HoloLens"))
    UnityEngine.VR.InputTracking.Recenter();
    }
    Doesn't appear to do anything. Found this related post titled, "Reset Hololens Origin" inquiring about a similar behavior. Two individuals affiliated with Unity in someway (both bare the 'Unity technologies' profile tag) brought up InputTracking.Recenter(). One adds, "[S]ome changes landed recently, and part of those changes were hooking up InputTracking.Recenter properly on WindowsMR."

    The snippet of code I include above is an attempt to implement this behavior. I most definitely could be trying to call this code in an improper/incorrect location but, as it is now, I do not see it working.

    end Update 1

    The white application windows box position isn't the problem. The user is and should be allowed to place the application wherever they may choose.
    The problem lies in if a user opens your app, via this white box, and blooms out of the app but does not close the white box - the apps state is then suspended/'tombstoned'. If a user goes to open your app via placing a new white box, the app will resume the previously suspended instance, rather then re-starting the app altogether and/or moving the app back into the users gaze.

    To ensure an optimal user experience, the app should always open and display directly in front of the users gaze. This happens on initial open (if no previous instance of the app was created and left opened [in the suspended / 'tombstone' state]), where as if an instance is open, when the user goes to open the app, it will re-open at the suspended location. This should not happen. The app itself needs to be moved back into the users gaze.

  • Options

    @jtth So you want to reset the 0,0,0 position whenever you bring the game back from being in the suspended state?

    AR Developer

  • Options

    @dbarrett said:
    @jtth So you want to reset the 0,0,0 position whenever you bring the game back from being in the suspended state?

    If I understand how the device works, and that resetting the apps position to Vector3.zero is infact repositioning the app to ensure it is visible to the users gaze OnResume - then yes that sounds correct

  • Options

    Maybe you can take a look at Resuming from the Windows docs?
    Or maybe take a look at OnApplicationFocus/OnApplicationPause from Unity docs?

    Or is the problem that you know what method to use but can't get the code to perform the "reset"?

    AR Developer

  • Options

    Each of these links pertains to exactly the issue I am speaking of.

    This link goes on to show that different Unity versions result in different bloom behaviour (in terms of app resuming/restarting) :
    https://forums.hololens.com/discussion/7209/different-bloom-behaviour-in-different-unity-versions#latest

  • Options
    jtthjtth
    edited December 2017

    @dbarrett said:
    Maybe you can take a look at Resuming from the Windows docs?
    Or maybe take a look at OnApplicationFocus/OnApplicationPause from Unity docs?

    Or is the problem that you know what method to use but can't get the code to perform the "reset"?

    Precisely what I have found on the matter. Perhaps implementing the following in OnApplicationFocus is what I am looking for..

    if(UnityEngine.VR.VRSettings.loadedDeviceName.Equals("HoloLens")) {
    UnityEngine.VR.InputTracking.Recenter();
    }
    

    Edit: I believe one need to look into OnApplicationPause and OnApplicationFocus if working with Unity. Otherwise if working with just UWP apps, look to two events called OnSuspend and OnResume. Or so I have been told thus far

  • Options
    dbarrettdbarrett ✭✭✭
    edited December 2017

    @jtth said:

    Each of these links pertains to exactly the issue I am speaking of.

    This link goes on to show that different Unity versions result in different bloom behaviour (in terms of app resuming/restarting) :
    https://forums.hololens.com/discussion/7209/different-bloom-behaviour-in-different-unity-versions#latest

    Here is some info on the app model that you might find useful.
    https://developer.microsoft.com/en-us/windows/mixed-reality/app_model#app_tiles

    Manipulating the App Tiles is not in a public API which means you cannot close the app tile within your app, only when you click the close button.

    "...You can also bloom to pause a game or to hide the Start menu..."
    https://support.microsoft.com/en-us/help/12644/hololens-use-gestures

    The bloom gesture is not meant to close an application but, only to suspend it.

    I mean if you are just trying to Reset the scene, you could just make a voice command and reload the scene that way?

    AR Developer

  • Options

    @jtth said:

    @dbarrett said:
    Maybe you can take a look at Resuming from the Windows docs?
    Or maybe take a look at OnApplicationFocus/OnApplicationPause from Unity docs?

    Or is the problem that you know what method to use but can't get the code to perform the "reset"?

    Precisely what I have found on the matter. Perhaps implementing the following in OnApplicationFocus is what I am looking for..

    if(UnityEngine.VR.VRSettings.loadedDeviceName.Equals("HoloLens")) {
    UnityEngine.VR.InputTracking.Recenter();
    }
    

    Edit: I believe one need to look into OnApplicationPause and OnApplicationFocus if working with Unity. Otherwise if working with just UWP apps, look to two events called OnSuspend and OnResume. Or so I have been told thus far

    That might work. I honestly haven't had to use it before.

    AR Developer

  • Options
    jtthjtth
    edited December 2017

    @dbarrett said:

    @jtth said:

    Each of these links pertains to exactly the issue I am speaking of.

    This link goes on to show that different Unity versions result in different bloom behaviour (in terms of app resuming/restarting) :
    https://forums.hololens.com/discussion/7209/different-bloom-behaviour-in-different-unity-versions#latest

    Here is some info on the app model that you might find useful.
    https://developer.microsoft.com/en-us/windows/mixed-reality/app_model#app_tiles

    Manipulating the App Tiles is not in a public API which means you cannot close the app tile within your app, only when you click the close button.

    "...You can also bloom to pause a game or to hide the Start menu..."
    https://support.microsoft.com/en-us/help/12644/hololens-use-gestures

    The bloom gesture is not meant to close an application but, only to suspend it.

    I mean if you are just trying to Reset the scene, you could just make a voice command and reload the scene that way?

    Rather then create a voice command and reload the scene, re-positioning the application itself into the users gaze should be done programmatically without the necessity of user interaction. To be clear, when I write re-positioning the app, I do not mean the white windows App tile which is placed to launch the Unity app. I mean the Unity app itself which launches after placing the white windows App tile.

  • Options
    jtthjtth
    edited December 2017

    @dbarrett said:

    @jtth said:

    @dbarrett said:
    Maybe you can take a look at Resuming from the Windows docs?
    Or maybe take a look at OnApplicationFocus/OnApplicationPause from Unity docs?

    Or is the problem that you know what method to use but can't get the code to perform the "reset"?

    Precisely what I have found on the matter. Perhaps implementing the following in OnApplicationFocus is what I am looking for..

    if(UnityEngine.VR.VRSettings.loadedDeviceName.Equals("HoloLens")) {
    UnityEngine.VR.InputTracking.Recenter();
    }
    

    Edit: I believe one need to look into OnApplicationPause and OnApplicationFocus if working with Unity. Otherwise if working with just UWP apps, look to two events called OnSuspend and OnResume. Or so I have been told thus far

    That might work. I honestly haven't had to use it before.

    It did not. Quoting an individual affiliated with Unity technologies, "Recenter doesn't take any parameters, and just makes it so the device's position when Recenter is called then becomes the origin."

    This would appear to me to be exactly what I was looking for, though it specifies the device's position becomes the origin, it doesn't specify objects already placed being updated to the new origin...

  • Options
    stepan_stulovstepan_stulov ✭✭✭
    edited December 2017

    It seems like the actual behavior of launching/resuming apps is troublesome and can't really be fixed. I'm also aware that it's been changed between Unity versions. This is a big problem. Tapping on a window should return you to that window's app, not another one's.

    To ensure an optimal user experience, the app should always open and display directly in front of the users gaze. This happens on initial open (if no previous instance of the app was created and left opened [in the suspended / 'tombstone' state]), where as if an instance is open, when the user goes to open the app, it will re-open at the suspended location. This should not happen. The app itself needs to be moved back into the users gaze.

    I sincerely don't understand whether this is an issue. The fact that the origin jumps doesn't seem to be a problem to me. You're not supposed to rely on any origin at all as a general rule of developing MR apps. The only reliable things are world anchors and the user herself. You're supposed to neither know nor care where 0,0,0 or app's pinned window is.

    Or are gaze (main camera) origin and direction being misreported to you? And/or are world anchors not being tracked properly?

    Hope to resolve your problem.

    Building the future of holographic navigation. We're hiring.

Sign In or Register to comment.