Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

How to recenter camera orientation on Oculus Quest in Unity?

bebop_devbebop_dev Posts: 15

I want to reorient the camera to the start position and rotation in my Unity app.

I tried this function, but it's not working on Oculus Quest: 


I noticed that the Oculus Quest home button on my Quest after a firmware update spawns the quit/resume app sub-menu, but does not reorient the position and rotation in the app. On an another Oculus without the firmware update, the home button still works.

I want to know if there's a way to directly call the native code for homing. I can tell through ADB that Oculus knows when the home button is pressed: 

I/InputHooks_Internal: InputHooks::nativeSetHomeButtonDown(5868.719727): 1698898178


  • SeabassMcGillsSeabassMcGills Posts: 3
    I would also love an answer to this question. Have spent the last two nights desperately trying to find a way to reset the view when a new scene loads in Unity. In addition to the RecenterPose() method I also tried using the "Reset Tracker on Load" checkbox on the OVR Manager component (which, of course, doesn't work). Really wish the documentation / support was better here.
  • SeabassMcGillsSeabassMcGills Posts: 3
    Found a workaround that will work for now in my case. More specifically, my issue was as follows:

    My game has a sequence of scenes that get loaded as the player progresses through. On a couple scenes in particular, the player can sometimes end up facing in a direction that I didn't intend, depending on what they're looking at when the transition happens. When the next scene loads in, the facing direction did not reset, and so the player could be staring at a wall wondering what the heck they're supposed to be doing. For this reason, I was trying to recenter the pose / camera on the scene load, before the frame faded back in.

    As stated earlier, I had no luck (and still have had no luck) getting the 
    command working on the Quest. It seems to work fine on my Oculus Go, but not the Quest.

    Anyways, the workaround I stumbled upon was this:
    <div>    public Transform OVRPlayerController;<br>&nbsp;&nbsp;&nbsp; private bool displayExistedLastFrame;
        public override void RecenterDisplay()<br></div><div>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Service.UpdateManager.AddObserver(OnUpdate);<br></div><div>&nbsp;&nbsp;&nbsp; }
    </div><div>&nbsp;&nbsp;&nbsp; private void ActuallyRecenterDisplay()<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OVRPlayerController.localEulerAngles = Vector3.zero;<br>&nbsp;&nbsp;&nbsp; }
    </div><div>&nbsp;&nbsp;&nbsp; private void OnUpdate(float dt)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (displayExistedLastFrame)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ActuallyRecenterDisplay();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Service.UpdateManager.RemoveObserver(OnUpdate);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
    </div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayExistedLastFrame = OVRManager.display != null;<br>&nbsp;&nbsp;&nbsp; }</div>
    To clarify a bit, I have a central update manager service that a register and revoke listeners to depending on the needs of any given class. In this case, I use it to wait 1 frame after the
    becomes available. No idea why this is necessary, but if it works, then I'm done wasting time spinning my wheels on this problem for now.

    I'm sure there are better solutions out there for this, and maybe if we're lucky someone from Oculus can get a better answer, but for now, I hope this answer helps you a bit on your end :)

  • GabrioGabrio Posts: 6
    Brain Burst
    Sorry, could you explain better your code? 
    I've the same issue but didn't found all the code you posted.
Sign In or Register to comment.