How to detect recenter on Quest/Meta devices

Hello,

How can I detect when the player has recentered themselves by long-holding the Oculus Home/System button?

It seems quite clear that it is not possible to query that button. But I'm also unable to find if there is perhaps a recenter event I could subscribe to? In this case I could use my own custom recentering logic to correctly position the player in the game.

I've noticed that various games have sold it somehow (Beat Saber, Prisms) so I'd like to think it is possible in a sensible way.

Best

In OpenXR XR Plugin package, https://docs.unity3d.com/Packages/com.unity.xr.openxr@1.6/api/UnityEngine.XR.OpenXR.Features.OpenXRFeature.html#UnityEngine_XR_OpenXR_Features_OpenXRFeature_OnAppSpaceChange_System_UInt64_

According to the OpenXR spec: https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrEventDataReferenceSpaceChangePending.html
The XrEventDataReferenceSpaceChangePending event is sent to the application to notify it that the origin (and perhaps the bounds) of a reference space is changing. This may occur due to the user recentering the space explicitly, or the runtime otherwise switching to a different space definition.

Thank you!

However, we are not using OpenXR as the backend but rather the legacy LibOVR + VRAPI.
How do we achieve this with the legacy backend?

We found we can use the OVRManager:

OVRManager.display.RecenteredPose += () =>
{
    // Reset player position here
    // ...
};
2 Likes

If you are reading this and wondering how to do that in OpenXR, see my response here:
https://discussions.unity.com/t/842657/21

You will need to enable the feature in Porject Settings, XR Plug-in Management, OpenXR, go find Reset View Feature under the OpenXR Feature Groups

You can add a listener to the event like this:

ResetViewFeature.AppSpaceChanged.AddListener(YourFunction);

For some reason OVRManager.display returns null. For new builds (after updating Unity and Meta SDKs), but also for builds already released in store.

I'm wondering if Meta changed something so this no longer works.

Hi, I'm a little late, but I just saw your message, since I encountered the same problem and solved it. simply the OVRManager.display variable must be saved as a variable to be used, it happens with temporary variables, because it is like initializing it, so, try this:

 private void Start()
    {
        var display = OVRManager.display;       

        display.RecenteredPose += RecenterPoseEventHandler;
    }

    private void RecenterPoseEventHandler()
    {
        Debug.Log($":: recenter pose hander ::");        
    }
1 Like

In my project, OVRManager.display.RecenteredPose doesn't work for me, it is only called at scene loaded and only called once. If I long press the menu button to reset view, it won't be called, by the way, I'm testing meta link with quest2.

I found the return value from OVRPlugin.GetLocalTrackingSpaceRecenterCount() will plus 1 every time I reset view from menu button. So I check this value in update to listen the reset view behaviour from player.

1 Like

thanks my friend, its the unique solution for me !