Skip to main content
New Participant
November 3, 2014

Follow Orientation in SDK 0.4.3

Hi there !
I might ask a stupid question (I'm pretty new in Unity and just got the dk2), but in a simple test project, I would like to set the orientation of the OVRCameraRig, and disable every orientation/position tracking. For instance, I would like to force the player to look in a specific direction, even though he's moving his head around (and I'm aware of all the discomfort it might cause, that's actually the purpose of my application). It seems that there used to be a "Follow Orientation" property in the Inspector (OVRCameraController script) but I can't find any of those...
Any help ? Thank !
    This topic has been closed for replies.

    6 replies

    New Participant
    November 3, 2014
    I'm having exactly the same problem here. How do we disable this rotation tracking?! I just don't know why the developers had to remove that "follow orientation" handy feature.
    Inspiring
    November 3, 2014
    You can set the OVRCameraRig as a child to the object you previously would have placed under "Follow Orientation".

    I'm not sure able disabling tracking altogether or forcing to a particular direction. This is probably not recommended.
    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
    Up and Coming
    November 3, 2014
    You don't need the follow orientation anymore as the camera rig inherits the parent rotation as it should do. Just set the camera rig a child of the object you want to follow and you'll have its rotation.
    Setting the rotation on the cameras in the rig to identity every frame will lock the rotation as you want it even though it probably will feel horrible. :)
    framidevAuthor
    New Participant
    November 4, 2014
    Hmmm, let's say I've just set my camera as a child of a cube (they are the only 2 object in my scene), but the camera orientation still moves as the player turns its head. It's not blocked on the cube. I want that player to look at the cube without the possibility to look anywhere else.
    In other words, setting the OVRCameraRig as a child of an object sets its orientation at start, but doesn't disable Orientation Tracking.
    Now, kwaver, could you please tell me more about your suggestion of setting the rotation in the rig ? :?: :)
    Up and Coming
    November 4, 2014
    The OVRCameraRig consists of 2 Unity camera objects - left and right. (There's also a middle but ignore that). If you select one of those cameras in the editor and move the rift, the rotation of that camera moves too.
    So getting those 2 cameras in a script and setting the rotation on them every frame will give you what you want such that the rotation won't change and stay on the rotation that you're supplying it every frame ie.
    LeftCamera.transform.localRotation = myfixedRotation;
    RightCamera.transform.localRotation = myfixedRotation;

    Hope that helps.
    framidevAuthor
    New Participant
    November 5, 2014
    Thank you kwaver.
    I'm actually modifying the OVRCameraRig.cs script to add my own "FollowOrientation" option :


    if (this.followOrientation) {
    leftEyeAnchor.localRotation = leftEye.orientation;
    centerEyeAnchor.localRotation = leftEye.orientation; // using left eye for now
    rightEyeAnchor.localRotation = rightEye.orientation;

    leftEyeAnchor.localPosition = leftEye.position;
    centerEyeAnchor.localPosition = 0.5f * (leftEye.position + rightEye.position);
    rightEyeAnchor.localPosition = rightEye.position;
    }

    That is the code part that seems to update each camera rotation at every frame.
    However, after my first tests, it seems that, even if the camera rotation is actually blocked, the image still "bumps" or "shakes" when moving the head... Any idea ?