Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Correct camera rotation (Oculus Rift)

Discussion in 'AR/VR (XR) Discussion' started by travelhawk, Jan 26, 2017.

  1. travelhawk

    travelhawk

    Joined:
    Jan 13, 2017
    Posts:
    2
    I was trying different approaches to use the second Xbox controller stick to implement camera rotation with the Oculus Rift. To do this I'm rotating the parent game object of the camera. However I was not getting a a fine result. It seems that the transform of the parent object and the camera get out of sync after a while. The camera scripts in the asset store seem to suffer by the same problem...

    This was my last approach:
    Code (CSharp):
    1.         void Update () {
    2.             // rotation by axis
    3.             cameraContainer.transform.Rotate (Vector3.up, input.RotateHorizontalAxis);
    4.             cameraContainer.transform.Rotate (Vector3.left, input.RotateVerticalAxis);
    5.         }
    Another approach was to use the up and right from the camera, but it was still not working fine:
    Code (CSharp):
    1.         void Update () {
    2.             // rotation by axis
    3.             cameraContainer.transform.Rotate (Camera.main.transform.up, input.RotateHorizontalAxis);
    4.             cameraContainer.transform.Rotate (Camera.main.transform.right, -input.RotateVerticalAxis);
    5.         }

    Do you have any suggestions to get a correct camera rotation?
     
  2. intrepidolivia

    intrepidolivia

    Joined:
    Aug 22, 2018
    Posts:
    2
    Did you ever find a solution to this issue?