Forum Discussion

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

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 !

6 Replies

Replies have been turned off for this discussion
  • yrcloud's avatar
    yrcloud
    Honored Guest
    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.
  • 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.
  • kwaver's avatar
    kwaver
    Honored Guest
    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. :)
  • 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 ? :?: :)
  • kwaver's avatar
    kwaver
    Honored Guest
    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.
  • 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 ?