Forum Discussion

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

Restricting Camera Rotation

Hi guys,

I'm developing a racing game using the Rift and just wondering if anyone has come up with an easy way of modifying the scripts to restrict the camera rotation (ie so that you cant fully look behind you or fully up/down).

I'm currently delving through the scripts to see if I can do it myself, but if anyone has come up with a solution already I'd love to hear it! (I'm guessing I'll have to play around with the SetCameraOrientation() function in OVRCamera.cs).

2 Replies

Replies have been turned off for this discussion
  • Hello there,

    Currently there is no way to disable camera rotation. However, this will be included in the next release; at this time you can go into OVRCamera.cs, look for OVRDevice.GetOrientation. The code looks like this:

    // Read shared data from CameraController
    if(CameraController != null)
    {
    // Read sensor here (prediction on or off)
    if(CameraController.PredictionOn == false)
    OVRDevice.GetOrientation(0, ref CameraOrientation);
    else
    OVRDevice.GetPredictedOrientation(0, ref CameraOrientation);
    }

    Simply wrap your condition to turn off reading the CameraOrientation here.

    FOr the next release, OVRCameraController.cs will include a new public bool variable EnableTracking. This can be used to toggle tracking on off.