cancel
Showing results for 
Search instead for 
Did you mean: 

OVRCameraRig - eye positions is different in GearVR to in Unity Editor

rosss_mop
Honored Guest
I have an OVRCamearRIg (from the prefab) in my Unity Scene.. when i build and run the project on my Android Gear VR - the camera position... i.e. the player's head position is noticably lower than in the Unity Editor... OVRCameraRig and all its children is placed at 0,0,0 in the scene...
any clues?! thanks
2 ACCEPTED SOLUTIONS

Accepted Solutions

bkane
Protege
We just ran into this today using Unity 5.4.2p4 and Oculus Utilities 1.9.0. It looks like there's some old code in OVRCameraRig.cs to work around a Unity bug that no longer applies. The workaround lowers the camera by a fair bit and I believe should be removed:

	private void Update()
{
EnsureGameObjectIntegrity();

if (!Application.isPlaying)
return;

UpdateAnchors();

#if UNITY_ANDROID && !UNITY_EDITOR

if (!correctedTrackingSpace)
{
//HACK: Unity 5.1.1p3 double-counts the head model on Android. Subtract it off in the reference frame.

var headModel = new Vector3(0f, OVRManager.profile.eyeHeight - OVRManager.profile.neckHeight, OVRManager.profile.eyeDepth);
var eyePos = -headModel + centerEyeAnchor.localRotation * headModel;

if ((eyePos - centerEyeAnchor.localPosition).magnitude > 0.01f)
{
trackingSpace.localPosition = trackingSpace.localPosition - 2f * (trackingSpace.localRotation * headModel);
correctedTrackingSpace = true;
}
}
#endif
}
Lines 119-134 should probably be removed from Oculus Utilities altogether. By default this was in a folded region of "#region Unity Messages" so it's easy to miss.

View solution in original post

drash
Heroic Explorer
Thanks bkane, this was very helpful!
  • Titans of Space PLUS for Quest is now available on DrashVR.com

View solution in original post

4 REPLIES 4

shomz
Honored Guest
I've noticed this as well, as of version 5.4.
There is no way to accurately position the camera for GearVR.

Radiusmedia
Honored Guest
yes. somehow. can anyone fix that?

bkane
Protege
We just ran into this today using Unity 5.4.2p4 and Oculus Utilities 1.9.0. It looks like there's some old code in OVRCameraRig.cs to work around a Unity bug that no longer applies. The workaround lowers the camera by a fair bit and I believe should be removed:

	private void Update()
{
EnsureGameObjectIntegrity();

if (!Application.isPlaying)
return;

UpdateAnchors();

#if UNITY_ANDROID && !UNITY_EDITOR

if (!correctedTrackingSpace)
{
//HACK: Unity 5.1.1p3 double-counts the head model on Android. Subtract it off in the reference frame.

var headModel = new Vector3(0f, OVRManager.profile.eyeHeight - OVRManager.profile.neckHeight, OVRManager.profile.eyeDepth);
var eyePos = -headModel + centerEyeAnchor.localRotation * headModel;

if ((eyePos - centerEyeAnchor.localPosition).magnitude > 0.01f)
{
trackingSpace.localPosition = trackingSpace.localPosition - 2f * (trackingSpace.localRotation * headModel);
correctedTrackingSpace = true;
}
}
#endif
}
Lines 119-134 should probably be removed from Oculus Utilities altogether. By default this was in a folded region of "#region Unity Messages" so it's easy to miss.

drash
Heroic Explorer
Thanks bkane, this was very helpful!
  • Titans of Space PLUS for Quest is now available on DrashVR.com