Skip to main content
Inspiring
February 22, 2015

Check for health and safety warning

Hi guys,

Does anyone know how to get whether the health and safety warning is displayed in a unity project? I think I am just missing something really simple.

Reading the API, it looks like I call it like this:

if(_hmd.GetHSWDisplayState().Displayed)
{
Debug.Log("warning is displayed");
}


My main problem is I don't understand how to create an object reference to Ovr.hmd. I have an OVRCamera in my project, is there some way I can get the IntPtr hmdPtr of the head mounted display in use? Or, is it more of a standard to call the static method like this:
_hmd = Ovr.Hmd.Create(Ovr.Hmd.Detect());


If the above code is what I need to use, any advice on using the detect method? It doesn't seem to return the correct integer of the Hmd in use.

Any advice on how to get a reference to the current HMD would be greatly appreciated. My apologies if this has been discussed before.
    This topic has been closed for replies.

    1 reply

    Inspiring
    February 23, 2015
    I came back with fresh eyes and found the solution to my problems.

    Here's how I ended up detecting whether the HMD's health and safety warning is displayed:
    		// Detect if health and safety warning is displayed:
    if(OVRManager.isHSWDisplayed == false)
    {
    Debug.Log("Health and safety warning pressed");
    }

    Thanks to user phileday and his post about that (I knew I should have searched more on the forums don't know how I missed that post).

    That lead me to finding out I can get a reference to the HMD by using the OVR Manager too. Here's the code to create a re-center button in case someone is looking for that too:

    // Get access to hmd amd re-center:
    Ovr.Hmd hmd = OVRManager.capiHmd;
    hmd.RecenterPose();
    Check out my Mobile VR Jam 2015 title Man Overboard! - Try the DK2 Version if you don't have a Gear VR