Skip to main content
Up and Coming
January 25, 2015

Camera switching question

Hi,

I cannot seem to be able to switch between a Oculus Rift Camera (OVRCameraRig)and normal Unity camera, I want to be able to turn off/on Oculus Rift Support ingame...

My test script I have so far is:

var cam1left : GameObject;
var cam1right : GameObject;
var cam2 : GameObject;
var wichcam = 0;

function Update () {
if(Input.GetKeyDown(KeyCode.C)){
if (wichcam==0){wichcam=1;cam1left.SetActive(true);cam1right.SetActive(true);cam2.SetActive(false);}
else{wichcam=0;cam1left.SetActive(false);cam1right.SetActive(false);cam2.SetActive(true);}
}}

Where cam1left+cam1right are assigned each OVR camera, the cam2 is for the normal Unity Camera.. Is disables the gameobects but the Oculus Rift view stays visible and it does not turn off the Oculus Rift rendering..?
I tried moving the OVRManager script to a seperate gameobject but that did not help, I tried searching the web for examples but haven't found anything yet.
Does anyone know how this could be done?

I'm using Unity 4.6 OVR SDK 4.4

Thanks in advance for any advice.
    This topic has been closed for replies.

    4 replies

    Up and Coming
    January 27, 2015
    That worked in the past but since DK2 it no longer does (and if I am wrong here please let me know - I have not been catching up with the forums lately!).
    check out my Mobile VR Jam 2015 title Guns N' Dragons
    Inspiring
    January 27, 2015
    I made a comment here that seems related:

    viewtopic.php?f=26&t=19183&p=240242#p236116
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    khos85Author
    Up and Coming
    January 28, 2015
    "cybereality" wrote:
    I made a comment here that seems related:

    viewtopic.php?f=26&t=19183&p=240242#p236116


    Ok thanks for the replies, I wonder why the camera's won't "turn off" or switch ? I don't understand the reason.
    I tried using what user dotMP3 did in that post but it did not help me at all.
    Hopefully the feature request will happen, it would be quite nice to switch Oculus rift mode on/off in games :)
    Inspiring
    January 28, 2015
    Yes, I did request the feature. Hopefully we'll be able to add it at a future time.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV