Skip to main content
Up and Coming
August 5, 2014

Switch between OVRCameraControllers

Hi,

in my project I have 2 OVRCameraControllers (well the CamController is attached to a GameObject) between which I would like to switch.

This is basically pretty straight forward:

        if (Input.GetButtonDown("HeadButtonRight"))
{
if (!useInsideCamera)
{
useInsideCamera = true;
outsideCamera.SetActive(false);
insideCamera.SetActive(true);
if (freecam != null)
{
freecam.enabled = false;
}
}
}
if (Input.GetButtonDown("HeadButtonLeft"))
{
if (useInsideCamera)
{
useInsideCamera = false;
insideCamera.SetActive(false);
outsideCamera.SetActive(true);
}
}


where
    public GameObject insideCamera;
public GameObject outsideCamera;


When I start the app, everything is rendered fine. I hit the head-button and it switches to the second OVRCameraController and the image is rendered as expected.

Now, when I hit the other head-button to switch back onto the first cam, the image freezes. It shows the last image of the second cam. Apparently nothing is rendered to the screen anymore.

In the scene view I can clearly see that the camera view is rotated via the HMD.

The OVCCameraController generates a camera which is used to render the image. The clear flags are set to don't clear. When the image is "frozen" and I change the clear flag from "don't clear" to "Skybox" the background get's drawn...

So it's not an application freeze and it's not a controller freeze...

The left/right eye cameras (their preview) still show's the updated image... so perhaps it's a lost render target? Or a stopped coroutine of the OVRCamera?


Has anyone tried such a 2 OVRCameraController setup and already solved this problem?

Thanks for suggestions and help :)
    This topic has been closed for replies.

    7 replies

    New Participant
    August 5, 2014
    I'm having a similar issue with a camera setup that involves switching between a 1st person, 3rd person, and Rift view. It worked fine with DK1 and works fine in all respects except that I'm having the exact same issue with a frozen scene being displayed but all other aspects of the game working properly. In addition I have an NGUI layer that is operating as expected on top of the camera layer.
    Up and Coming
    August 5, 2014
    VisiR - Virtual Reality Music Visualisation
    Up and Coming
    August 5, 2014
    I also had this issue on Mining Mike.. how I got it working was that I didnt disable the first cam.. just enable and disable the second cam, which has to be placed higher at the hierarchy so it overrides the first one. I got some issues with Timewarp enabled on both cams. Just enabling it on one cam did the trick.
    http://www.riftaway.com | http://www.chillyvisions.com
    Inspiring
    August 5, 2014
    "Dreymo" wrote:
    I also had this issue on Mining Mike.. how I got it working was that I didnt disable the first cam.. just enable and disable the second cam, which has to be placed higher at the hierarchy so it overrides the first one. I got some issues with Timewarp enabled on both cams. Just enabling it on one cam did the trick.


    Me too. Waiting for a solution :/
    MIND LABYRINTH VR DREAMS MIND UNLEASHED
    Inspiring
    August 6, 2014
    Scorched Battalion - VR Jam edition available for Gear VR and DK2 (Win/Mac/Linux) Jungle Juice Sven Co-op
    New Participant
    August 6, 2014
    Thanks, I'll look into it and see if it works for me. I've gone back to DK1 as I'm on a bit of a deadline for a demo but I'll post back here once I know something.
    SMatonAuthor
    Up and Coming
    August 8, 2014
    Sounds good... I think the initial problem is due to the thread that is created when a OVRCamera is instanced. If you deactivate the camera, the thread remains; but the ID of the texture might change...

    I'll check this on Monday... because for me, it's week end time :)
    Sentinels of Liberty - Homebound Sentinels of Liberty - Homebound on Facebook