Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
khos85's avatar
khos85
Explorer
11 years ago

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.

4 Replies

Replies have been turned off for this discussion
  • Gerald's avatar
    Gerald
    Expert Protege
    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!).
  • "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 :)
  • Yes, I did request the feature. Hopefully we'll be able to add it at a future time.