Skip to main content
New Participant
February 5, 2014

Cannonical way to determine if Rift is present?

I am trying to make one project that I can build for Windows with the Rift, Windows without the Rift, Android, and the web player. I have separate player controllers for Android, Rift, and non-Rift, and a Start() function that turns off the controllers that are not needed for a particular platform.

I am having great difficulty determining whether or not the Rift is attached. I have checked OVRDevice.IsInitialized() and OVRDevice.IsHMDPresent(), and both seem to be true if I have the OVRPlayerController, regardless of whether the device is actually present.

What should I be checking?

Thanks,

Lynn Grant
Cross Design Group LTD
    This topic has been closed for replies.

    5 replies

    Inspiring
    February 5, 2014
    That sound strange. Let me see if this is a bug or if there is a work around.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    February 6, 2014
    This is a little ambiguous even when it works. Everything seems to report that the Rift is there and functional as long as it is plugged in via USB, even if the display cable is unplugged or the power is off.

    It would be nice to have an easy way to know if the Rift is actually in a usable state. Not as much for Unity right now because you can't change the display adapter at runtime, but in general it makes sense from a user perspective to toggle VR on and off using the hardware button.

    While we are on the subject, it would be nice if the display adapter disconnected itself when the power is turned off, like a TV would.
    Up and Coming
    February 6, 2014
    Which is what it does. Only that "power" button only affects the display. The rest of electronics is permanently on and powered via USB. And thus you can't tell if it's on or off, neither it really should matter - I don't want to turn my Rift on just to test if some app actually works.

    There should be a menu switch.
    Inspiring
    February 6, 2014
    You can try taking a look at the events that get fired from OVRDevice (check around line 294 in function Update()).

    I believe this should be enough to detect whether the Rift it plugged in or not.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    sh0v0r
    Up and Coming
    February 11, 2014
    "lgrant" wrote:
    I am trying to make one project that I can build for Windows with the Rift, Windows without the Rift, Android, and the web player. I have separate player controllers for Android, Rift, and non-Rift, and a Start() function that turns off the controllers that are not needed for a particular platform.

    I am having great difficulty determining whether or not the Rift is attached. I have checked OVRDevice.IsInitialized() and OVRDevice.IsHMDPresent(), and both seem to be true if I have the OVRPlayerController, regardless of whether the device is actually present.

    What should I be checking?

    Thanks,

    Lynn Grant
    Cross Design Group LTD


    If the rift is disconnected from the USB there will be no sensors.


    if (OVRDevice.SensorCount > 0) // Rift is present


    I made a post about this a few months ago:
    viewtopic.php?f=37&t=1648

    There probably should be a nicer way to do this by checking some SDK flag that makes the code nicer to read.