Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
stackdev802's avatar
stackdev802
Honored Guest
9 years ago

Can you use Oculus Utilities in the new Unity VR integration? Seems to be overriding OVRCameraRig

Hey everyone,

I've been developing for the GearVR. Typically i'd just the OVRCameraRig prefab, and that would control the rendering to my device.

I liked this, because it gave me access to the rotation of the device, and I could implement funky features that are not included in the base SDK (like disabling head tracking, altering it, etc).

However, it seems that something is over-riding my use of the OVRCameraRig. Typically, i could manipulate things within the UpdateAnchors() method in OVRCameraRig.cs.

However, now, even if i comment out the ENTIRE method (which is used to set the anchor rotations), i am still getting a normal virtual reality experience.
Is the new Unity VR integration over-riding the OVRCameraRig or something? how do I go back to using it, as I can't find ANY way to get into the InputTracking to manipulate things there?

Note:
Unity Version 5.4.2f2
Oculus Utilities off the website.

As for sharing code, literally commented out everything in the UpdateAnchors method and it still tracks head movements..

7 Replies

Replies have been turned off for this discussion
  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    OVRCameraRig is a utility that's built on top of Unity's built-in VR support. You don't need it for VR rendering, but it can be helpful as you described.
  • Well thats my problem - I need to alter the VR Input tracking to do different things (e.g., simple example - turn it off completely). In the past i've done it by disabling that code in UpdateAnchors(). 
    If it is built ON TOP of the VR support, is there any way to use JUSt it? making changes/alterations within the OVRCameraRig does absolutely nothing in my builds - its almost as if it is discarded.
    I know the scripts are running as I can print to log from the UpdateAnchors() method and see the statements - But editing the rotations and such just doesn't do anything.

    Its my guess that the VR integration's InputTracking is over-riding the OVRCameraRig rotation changes?

    Let me outline what i'm doing step by step in my SIMPLE example.
    1) New Project, new scene. Simple cube in the scene.
    2) Import oculus utilities, and copy in my signature file for my phone
    3) Remove the main Camera in the scene, drop in the OVRCameraRig Prefab
    4) Edit OVRCameraRig.cs to adjust the UpdateAnchors method as mentioned previously (Either commenting out the whole thing, or setting each of the variables rotation to Quaternion.Identity)
    5) Build settings, add scene and configure android build, and check "VR Enabled"
    6) Build and run, 
    7) See the expected "Insert into Gear VR", see the VR splash screen, and then i see my scene. Tracking is COMPLETELY not effected despite completely disabling or altering the UpdateAnchors() (Which definitely runs - I can verify from print statements). 

    Thoughts? Am i missing something here?
  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    If it is built ON TOP of the VR support, is there any way to use JUSt it?

    Sorry, not at this point. You could use our Unity 4 integration to avoid depending on Unity's built-in VR, but it won't work with Unity 5.

    making changes/alterations within the OVRCameraRig does absolutely nothing in my builds

    One thing you could do is cancel out the effect of Oculus tracking by inverting it in the pose of OVRCameraRig.trackingSpace in OVRCameraRig.UpdatedAnchors.

  • vrdaveb said:


    One thing you could do is cancel out the effect of Oculus tracking by inverting it in the pose of OVRCameraRig.trackingSpace in OVRCameraRig.UpdatedAnchors.


    This seems extremely computationally expensive, no? Won't this have large negative effects on the frame rate?
    (and thank you for your replies..)

  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    See my code sample in the following link: https://forums.oculus.com/vip/discussion/comment/446956/#Comment_446956

  • vrdaveb said:

    See my code sample in the following link: https://forums.oculus.com/vip/discussion/comment/446956/#Comment_446956


    Will do tomorrow first thing - I did implement something similar (i think) where i rotated the parent of the camera to the inverse, but that caused a real nasty jitter effect where Unity's VR would move it, then i'd rotate it back.

    Would inverting it at the Pose level solve the jitter issue?
  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    Yes, We've provided some code for zeroing out the effect of Oculus tracking in the OVRPose class. See how it's used in the FakeTracking.cs sample above.