cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplayer with OVRPlayerController prefab and center eye issue

Anonymous
Not applicable
Hi!
I'm trying to make a multiplayer application using Unity 5.4.1p1 with Oculus 1.10.0.308075. Using Unet for network management and use OVRPlayerController prefab as spawn info > player prefab. Problem is, when i create a session and load first scene by clicking a button at lobby scene, center eye anchor transforms x rotation doubles somehow. If i click create session button on a panel (center eye rotation ~= x: 24 y:0 z:0), at the loaded level center eye x rotation becomes ~49. Meanwhile left and right eye cameras x rotations are ok (~24).

What can be the reason? What can be the solution?
18 REPLIES 18

vrdaveb
Oculus Staff
I took a quick look at this and the problem is that Unity isn't marking the Camera's pose as immutable as soon as it's enabled. If a script (such as OVRCameraRig) tries to set a VR Camera's pose in the first frame after it's been enabled, the setting prevails and gets latched as the Camera's new reference frame. The intended behavior is for the Camera to immediately latch its pose and make it immutable to scripts when it's enabled with VR support. For now, you can work around this by modifying OVRCameraRig.cs. If OVRCameraRig.usePerEyeCameras is true, comment out the lines in the following that refer to centerEyeAnchor. Else comment out the lines that refer to left/rightEyeAnchor. We'll ship a slightly more robust code change in an upcoming copy of the Utilities and work with Unity to get the root issue fixed.

trackerAnchor.localRotation = tracker.orientation;
centerEyeAnchor.localRotation = VR.InputTracking.GetLocalRotation(VR.VRNode.CenterEye);
leftEyeAnchor.localRotation = monoscopic ? centerEyeAnchor.localRotation : VR.InputTracking.GetLocalRotation(VR.VRNode.LeftEye);
rightEyeAnchor.localRotation = monoscopic ? centerEyeAnchor.localRotation : VR.InputTracking.GetLocalRotation(VR.VRNode.RightEye);
leftHandAnchor.localRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch);
rightHandAnchor.localRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);

trackerAnchor.localPosition = tracker.position;
centerEyeAnchor.localPosition = VR.InputTracking.GetLocalPosition(VR.VRNode.CenterEye);
leftEyeAnchor.localPosition = monoscopic ? centerEyeAnchor.localPosition : VR.InputTracking.GetLocalPosition(VR.VRNode.LeftEye);
rightEyeAnchor.localPosition = monoscopic ? centerEyeAnchor.localPosition : VR.InputTracking.GetLocalPosition(VR.VRNode.RightEye);
leftHandAnchor.localPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch);
rightHandAnchor.localPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch);

treefortress
Protege
That's correct, our code always enabled the CameraRig on Start(), and it worked great with PSVR and with StreamVR for months. It wasn't until we implemented the Oculus Rig, that we began seeing this really strange behavior.

So I can't speak to the details behind it, only can say this is the only platform it occurs on and it's very annoying and must've wasted many peoples time. 

Thanks for the workaround, will test it out!  

mythicalcity
Explorer
Hi, we're having the same issue using Photon to instantiate our player. Tried the above code change but it didn't do anything. Using Unity 5.4.3.  are there other steps to perform or specific version numbers of oculus or unity that this fix will work with?

vrdaveb
Oculus Staff
If the Camera is being instantiated by Photon, then Photon is probably setting its position/orientation due to the same Unity bug. Try disabling it immediately after instantiation, setting transform.localPosition=Vector3.zero; transform.localRotation=Quaternion.identity, and then re-enabling it a frame later.

kendrome
Honored Guest
Did anyone get a working solution for this? I tried both of vrdaveb's suggestions and neither one works for our project.

lpug21
Honored Guest


This has been determined to be a bug within Unity itself. We should have a fix for this in the Oculus Utilities 1.11 release due out by 1/26/17.


Hey imperativity, any movement on this front?  Keen for this issue to be resolved in something I'm looking to deploy in a few weeks.

Aleksey33
Not applicable
Hi!
Can you help me in next question ?

I have an element that should always be displayed in front of me (you can see on the screenshots).  I created it in world space and added to it a separate chamber which renders it only.
For a player I use OVRCamrig. But 
it rotate the camera, which is located in a separate object. How do I lock the camera is not in OVRCamrig?

Aleksey33
Not applicable
Hi!
Can you halp me in next question ?

I have an element that should always be displayed in front of me (you can see on the screenshots).  I created it in world space and added to it a separate chamber which renders it only.
For a player I use OVRCamrig. But 
it rotate the camera, which is located in a separate object. How do I lock the camera is not in OVRCamrig?


Aleksey33
Not applicable
Hi!
Can you halp me in next question ?

I have an element that should always be displayed in front of me (you can see on the screenshots).  I created it in world space and added to it a separate chamber which renders it only.
For a player I use OVRCamrig. But 
it rotate the camera, which is located in a separate object. How do I lock the camera is not in OVRCamrig?