Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Problem with InputTracking.Recenter();

Discussion in 'AR/VR (XR) Discussion' started by Ozy51, Jul 1, 2016.

  1. Ozy51

    Ozy51

    Joined:
    Jan 14, 2014
    Posts:
    1
    I'am having a problem with the recentering of OVRCamera. I use a single scene and move between "stages" enabling and disabling Cameras, and so far it works well. The only problem is that the Iine
    Code (CSharp):
    1. UnityEngine.VR.InputTracking.Recenter();
    in certain stages works well and some it won't.

    For example if i'am at the main menu the camera starts centered and aligned with the front direction of the headset, if i turn my head and recenter, it will do what is supposed to. But when i change to the game scene, it has a different behaviour. Whenever i recenter the camera, it will face slightly rotated to the right, which will force the user to rotate that difference to center it's direction. If i go back to the menu stage or pause stage, it all works as supposed again. I'll post some pictures to explain. Important to highlight that no rotation to the scene or camera is made.


     

    Attached Files:

    • t1.PNG
      t1.PNG
      File size:
      46.4 KB
      Views:
      811
    • t2.PNG
      t2.PNG
      File size:
      55.9 KB
      Views:
      1,004
  2. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    311
    Which version of Unity are you using?
     
  3. mbcauley

    mbcauley

    Joined:
    Jun 1, 2013
    Posts:
    36
    Not sure if this is the same issue I was having, but whenever I used Recenter() and then tried to rotate the camera right after it would not rotate to the angle I specified. I noticed if I waited a single frame after the recenter then I could rotate the object correctly. Something like this:
    Code (csharp):
    1.  
    2. // use this in a coroutine
    3. UnityEngine.VR.InputTracking.Recenter();
    4. yield return null;
    5. transform.rotation = Quaternion.Euler(0f, 45f, 0f);
    6.  
     
  4. wws_1234

    wws_1234

    Joined:
    Aug 25, 2016
    Posts:
    1
    i try to this,but it does not work .........TT
     
  5. Filenasc

    Filenasc

    Joined:
    Aug 30, 2016
    Posts:
    1

    hey! tried this one also but it doesn't work. I think this problem may be Unity5.3.3 Bug or 5.3.2p1? My google skills are not working.
     
  6. HanClinto

    HanClinto

    Joined:
    Oct 3, 2013
    Posts:
    1
    I was having a similar issue, and finally figured out that mouse movement was interfering with the recenter() application. For my demo, I was able to disable the mouse movement entirely, and this resolved the issue.
     
  7. hellowill89

    hellowill89

    Joined:
    Jan 8, 2013
    Posts:
    45
    I have this same issue. If you want to perform a rotation immediately before or after calling `Recenter`, it needs to be called twice on subsequent frames in order to work as expected.

    The code which works for me looks like this. Works 100% of the time but there is a visual hiccup as it reorients.

    ```
    InputTracking.Recenter();
    yield return new WaitForSeconds(.06f);
    transform.rotation = Quaternion.Inverse(InputTracking.GetLocalRotation(XRNode.CenterEye));
    ```
     
    Last edited: Jan 23, 2018
  8. hariprathaap

    hariprathaap

    Joined:
    Aug 22, 2017
    Posts:
    2
    What do you mean by twice? Can u elaborate?