cancel
Showing results for 
Search instead for 
Did you mean: 

[Photon PUN 2] Camera “freezes” in the Oculus Quest when second player joins room

echin
Honored Guest

I'm building a Unity VR multiplayer application, following this course on Udemy. In the course, they use the Unity XR Interaction toolkit, but I've been using the Oculus Integration package instead. So far, this hasn't created any significant problems - until I begin testing with two players.

I've been running into a problem where the moment a second player enters a room, the camera inside the VR headset goes wonky. It becomes frozen or fixed at a certain position, as if the world is stuck to the camera. I know that the scene still runs because I tried it with my headset pointing at a campfire with particle effects, which were still moving and running fine. I found a link here that describes pretty much exactly the problem I'm running into, except their solution didn't work for me. I also don't have control over my hands / avatar - it's like I'm being placed in the headset but I'm not actually there. I'm quite baffled, and I'm not sure what to do anymore.

I created a bare minimum application here with two scenes that duplicates the issue. One weird thing is when I open the application in my Quest, and then open it in my editor, and then close and reopen the application in the editor one more time, the camera in my Quest goes back to normal, but I still can't do anything with my controllers.

Before anyone mentions it, I've set in script to have a player's OVRCameraRig become disabled if IsMine is false (ie, so camera rigs aren't kept on for remote players). So at all times, there will only be one camera rig in the scene for the local player.

8 REPLIES 8

julienkay
Adventurer

This does sound like a problem of multiple cameras being active in the scene at the same time.

 


@echin wrote:

Before anyone mentions it, I've set in script to have a player's OVRCameraRig become disabled if IsMine is false (ie, so camera rigs aren't kept on for remote players). So at all times, there will only be one camera rig in the scene for the local player.


The problem with this is that simply disabling the OVRCameraRig GameObject won't be enough. For one, if you look into OVRCameraRig.cs it subscribes to Application.onBeforeRender which is invoked even if the Script/GameObject is disabled and in turn can re-enable the cameras of a remote OVRCameraRig. Another thing is, that scripts like OVRManager are essentially singletons that are accessed through a static accessor OVRManager.instance. If you have multiple singletons in a scene you're bound to run into problems (no matter if the script is disabled or not).

 

Generally I would strongly advice against spawning a full OVRCameraRig for every joining player. Those prefabs are really only meant to be run locally.

NicolasAbo17
Explorer

Hello! I'm stuck in the same thing, were you able to resolve it?

yasmeen321
Honored Guest

I had the same problem and I managed to fix it by adding camera rig in the scene and NOT instantiating it whenever someone joins 

I ONLY instantiated the avatar itself.

homsar47
Explorer

Has anyone found a solution that works with instantiating the object? I've tried disabling the camera rig and enabling it on awake but it causes issues with the player height for reasons unknown.

Edit: I would like to add that if anyone knows why disabling then enabling the player rig breaks height I'd love to know. I wouldn't have any problems with disabling then enabling the camera rig if I could do so without breaking the OVRCameraRig height position.

Not sure why , but you can set the y value for the camera rig in the awake function 

AdamsCheng
Protege

@echin 

Hi !   I 'm follow same course and same issue when used OVRcameraRig. (It's fine if the camera is an XR Rig.)

Has your problem been solved ?

Its happening with me and the only thing I could think of was to add a scene instead activate or instantiate another camera.

In my game I have a player with a VR camera. When he hits a trigger the player is destroyed and the VR camera in the ship takes over but it freezes so the only solution was to have 2 scenes. One with the player outside the ship, scene one. The other the player takes control of the ship. When the player object is destroyed hitting the trigger the trigger also load the scene two. Easy done with Chat GPT. Today is 3/04/23. Brazilian man living in Australia for many years 😊