Search Unity

Don't allow the Rift to pause the application?

Discussion in 'AR/VR (XR) Discussion' started by Thomas-Mountainborn, Aug 17, 2016.

  1. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    501
    I need the application to keep running at all times, even when the user takes off the headset. I haven't found an option to disable the automatic pause in either the native VR support or Oculus' OVR plugin - has someone else who has the same requirements found a way of doing this (which does not include taping the proximity sensor), perhaps?
     
  2. LordMortis

    LordMortis

    Joined:
    Jan 25, 2014
    Posts:
    27
    Yes, how do you do this?
     
  3. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Anyone find a solution to this?
     
  4. NielsTerHeijden

    NielsTerHeijden

    Joined:
    Mar 4, 2014
    Posts:
    20
    Very interested in a possible solution too. At the moment it seems to also mess up the microphone input in Unity when the game world get paused.
     
  5. Quen

    Quen

    Joined:
    Apr 6, 2010
    Posts:
    21
    Looking for the same, but I guess tape is our best friend here... :-/
     
  6. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    501
    The Rift will still pause when the HMD has been stationary for some time, so even tape is no good. This is such a basic thing to expose in Unity though, it's high time it makes it in.
     
  7. RafSil

    RafSil

    Joined:
    Feb 17, 2017
    Posts:
    1
    levlaj and Thomas-Mountainborn like this.
  8. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    If you download the Oculus SDK and browse around in the Unity sample application, you can find the code that does what you want, and trace it back to the specific DllImport function in the OVR plugin that needs to be called. Don't worry, Unity already provides the DLL for you, so you don't need to jump through extra hoops to support this.

    Example:

    [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
    public static extern Bool ovrp_SetAppIgnoreVrFocus(Bool value);

    You can do the same for directly checking if the sensor sees that the user is present or not by using this:

    [DllImport("OVRPlugin", CallingConvention = CallingConvention.Cdecl)]
    public static extern uint ovrp_GetStatus2(uint query);

    where query is an enum value that maps to Status.UserPresent. This is the enum that's been copied from the SDK code:

    private enum Status
    {
    Debug = 0,
    HSWVisible,
    PositionSupported,
    PositionTracked,
    PowerSaving,
    Initialized,
    HMDPresent,
    UserPresent,
    HasVrFocus,
    ShouldQuit,
    ShouldRecenter,
    ShouldRecreateDistortionWindow,
    }