Skip to main content
New Participant
February 2, 2015

Need to disable movement completely

Here's what we're trying to do:

We've mounted a physical camera device on the oculus, and we just want to show the output of the camera on a texture on the scene, and overlay various indicators/whatever on the scene. So we've got that working nicely, but the camera rig keeps changing its position when the user moves their head -- which is definitely not what we want (since it's showing the outside camera output... don't need it).

Basically, we don't want it to be a VR headset right now, just want the oculus to be a nice passthrough display.

Using unity pro and the latest sdk... 0.4.3 I think?

I've seen previous suggestions to disable the UpdateAnchors() function, but that just makes the game view shake a LOT. Using the various options on the rig doesn't seem to make any difference either (disable position tracking, etc). Any thoughts on how to do this?
    This topic has been closed for replies.

    83 replies

    New Participant
    December 9, 2015
    @vrdaveb, again thank you for the help.

    I have tried and re-tried the methods provided (now with updated utilities) and am still not having success.
    Similarly to VRDynamics, the
    trackingSpace.FromOVRPose(centerEyeAnchor.ToOVRPose().Inverse());
    results in strange stuttering but still will track the rotation of the gearVR.
    I tried
    OVRPlugin.rotation = false;
    as well in void Awake() (and also with first execution order) but this seemed to have no effect.

    Are these working on your end and I'm doing something wrong? Or is this code unconfirmed to disable movement?

    Really appreciate the help whenever you can get back :D
    Inspiring
    December 10, 2015
    "seanicboom" wrote:
    trackingSpace.FromOVRPose(centerEyeAnchor.ToOVRPose().Inverse());

    Try this in Awake:
    		var rig = GameObject.FindObjectOfType<OVRCameraRig>();
    rig.UpdatedAnchors += r => r.trackingSpace.FromOVRPose(rig.centerEyeAnchor.ToOVRPose(true).Inverse());
    I just tried it and it works, but there is a slight wobble because it is canceling out the pose on the main thread, before TimeWarp. If that is a deal-breaker, your only option right now is to use Unity 4 and our legacy integration. There, you can customize the tracking behavior as much as you like by editing OVRCameraRig.cs.
    March 29, 2016
     vrdaveb said:




    seanicboom wrote:

    trackingSpace.FromOVRPose(centerEyeAnchor.ToOVRPose().Inverse());


    Try this in Awake:
    var rig = GameObject.FindObjectOfType&lt;OVRCameraRig&gt;();
    rig.UpdatedAnchors += r =&gt; r.trackingSpace.FromOVRPose(rig.centerEyeAnchor.ToOVRPose(true).Inverse());

    I just tried it and it works, but there is a slight wobble because it is canceling out the pose on the main thread, before TimeWarp. If that is a deal-breaker, your only option right now is to use Unity 4 and our legacy integration. There, you can customize the tracking behavior as much as you like by editing OVRCameraRig.cs.


    Thanks for the info, 
    It seems the reason is that oculus is dealing with the position sync on a separate thread.

    In short, this is not doable in Unity 5, right?
    (I tested and the wobble is more than expected.)
    Is the situation be the same with Unreal plugin?
    New Participant
    April 8, 2016
    Is this feature (disabling the link between Rift and scene camera) included in the latest Rift release?

    The suggestion from vrdaveb does not work well for me. I have seen some jitter(the scene camera moves) when the wearer moves suddenly.
    New Participant
    April 17, 2016
    Using SDK 1.3 and Unity 5.3.4p1.

    Still wrapping my head around how Unity cameras work when a VR device is detected.

    Simple case: I am using a camera to develop a HUD, which moves along with the user's head movements, and so *should not* have its transform hijacked by OVR/Unity.  I've tried all of the above, where applicable to 1.3, but all active cameras are still being driven.

    The HUD can be done using a RenderTexture, sure, but my app also requires the ability to switch out of VR mode (without disabling the VR device), so I really need to be able to simply block OVR/Unity from messing with the camera transforms.

    Did I miss something or is this currently rather impossible?

    A simple 'VR transforms enabled' flag on the camera would be nice, though that would require tight collab with the Unity team.
    Participant
    February 8, 2017
    Still no solution for Unity 5.5.1 + Oculus Unity Utilities 1.10.0? Using of inverse rotations causes insane wobbling and I really can not downgrade the project to Unity 4.
    Participant
    February 9, 2017
    Yes, I used the variation of this script and this comes at a cost of noticeable wobbling. Here is the idea of what I'm trying to do: https://youtu.be/3FRz05T-qMs?t=9s (there are two variations of control implementation in the same video, I'm talking about the variation with external gamepad).
    This is actually the same project made with Unity 4 and other VR SDK. Now I'm trying to do the same with native Unity 5 support for GearVR and its touchpad instead of external gamepad.
    I've tried to implement this functionality with native VR support disabled, but could not find a working solution so far.
    Participant
    February 10, 2017
    @imperativity, interesting idea, I gave it a try but had no luck so far.
    TL;DR: I see that render textures are filled with images but the screen is black. Also I'm curious how to make render textures used for overlay different to emulate left and right eye.

    From what I learned on the documentation page for compositor layers, I have to add two cameras under corresponding anchors inside OVRCameraRig, one for each eye, that are supposed to render into texture the image instead of regular cameras attached to LeftEyeAnchor and RightEyeAnchor.

    Here is my setup:
    1) Object hierarchy

    2) OVRCameraRig setup

    3) RenderTexture setup

    4) Culling mask for cameras on LeftEyeAnchor / RightEyeAnchor are set to Nothing, depth = 0.
    5) Proper culling masks set for cameras on LeftEye / RightEye: 

    However, during runtime, the OVROverlay script attached to OVRCameraRig remains disabled, I guess that this is the main reason for resulting in black screen. What I might have missed?
    Participant
    February 10, 2017
    @imperativity, as I mentioned in my previous post, I followed exactly this documentation page and used OVRRTOverlayConnector scripts on cameras - you may see them in my screenshot for point 5. Overlay camera depths are less than main camera depths. What else could prevent OVROverlay from being enabled during the compositor layers rendering cycles?

    EDIT: OVROverlay was disabled because its OnEnable() contained a block:

    if (!OVRManager.isHmdPresent)
    {
    enabled = false;
    return;
    }

    However, commenting of this lines did not solve the black screen problem (but after that OVROverlay became enabled all the time)
    Inspiring
    February 11, 2017
    Sorry for jumped in suddenly,  I'm not quite clear why we play ovrOverlay here,   Looks like we want to output eyetexture into a RenderTexture?  
    if yes.
    1)  why we set CullingMask for RightEye/LeftEye camera?  both of them should see the whole scene , right?
    2) as far as I known,  once you give a camera a TargetTexture, it is not a stereo camera anymore in Unity,  Set TargetEye can't help ( and probably just trigger some bug),
    I'm not sure if you have any other stereo camera in the scene beside leftEye/rightEye,  if not,  looks there is no camera will send image to the HMD then.

    Also just want to mention
    1) OvrOverlay  is rendered in the compositor outside of Unity, so there will be no any renderToTexture can capture the overlay result  in Unity ( it only show on the hmd screen )

    2) I noticed you "Use Per Eye Camera" checked,  which is not recommended from performance point of view ( shadow map will be render twice , culling is not optimal ),  please don't use it unless you have to.

    If you just want to capture eye texture output into a RenderTexture,  I'll recommend copy the the texture out by using OnRenderImage 
    https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnRenderImage.html