Search Unity

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:
    22
    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:
    3
    Did you ever find a solution to this issue?