Forum Discussion
sh0v0r
13 years agoProtege
Correct Way To Detect The Hardware
I'm trying to make my game automatically switch to OVR mode when the Hardware is detected but I'm unsure as to how to do that correctly? I have tried doing this: if (OVRDevice.IsHMDPresent()) ...
excelynx
12 years agoHonored Guest
"blank0" wrote:
I'm starting to integrate the Oculus Rift to a simple scene in unity.
I have two cameras in the scene, one is the main camera from Unity and the second one is the camera controller of the Oculus rift. I detach the OVRDevice script from the camera controller but the behavior hasn't change. If the empty object that contains the OVRDevice script is enabled, the OVRDevice.IsSensorPresent() will always return true. The same happens with the IsHMDPresent(). I'm using the DK1 with the 0.4 SDK, I don't know if that has something to do with it.
Is there any other way to detect the actual hardware device?
I noted the same issue in my post here: https://developer.oculusvr.com/forums/viewtopic.php?f=37&t=10892#p143830
Warning: It does not appear you can rely on these values returning the correct value until after Awake()/Start(). Either fiddle with script execution order, or put your Rift-detection logic in Update().
drash might be right here, it's possible they've recently changed this behaviour in 0.4. I'm calling IsHMDPresent() in the exact same place where it worked in 0.2 and 0.3, and it doesn't seem to be working correctly in 0.4 - but I'll see if delaying the check makes any difference.
Edit: IsHMDPresent(), IsSensorPresent() and IsCameraPresent() do appear to be returning true regardless of the device state even with OVRDevice earlier in execution order and/or in an Update loop. I think this is just an issue with 0.4.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 2 years agoAnonymous