+1 vote
by (850 points)
recategorized by

Recenter doesn't work on Pico G2 with Unity XR Plugin

https://github.com/picoxr/Overlay-Demo-UnityXR

PXRPlugin.Sensor.UPxrOptionalResetSensor(1,1) doesn't work either

Pico XR 1.2.4

Quite important function for my application

Camera rig enter image description here

XR Rigenter image description here

This code works, if you didn't press recenter button before

        System.Collections.Generic.List<InputDevice> devices = new 
        System.Collections.Generic.List<InputDevice>();

        InputDevices.GetDevicesAtXRNode(XRNode.GameController, devices);
        if (devices.Count != 0)
        {
            devices.ForEach(x => x.subsystem.TryRecenter());\
        }

        InputDevices.GetDevicesAtXRNode(XRNode.Head, devices);
        if (devices.Count != 0)
        {
            devices.ForEach(x => x.subsystem.TryRecenter());\
        }

But problem is that it should be assigned to long press pico button!

1 Answer

0 votes
by (44.8k points)

Hello, you need to add the PXR_Manager script to the XR Rig.

by (850 points)

But this breaks the idea of XR manager and idea is to avoid platform-specific scripts and have solid interface....

by (850 points)
void Awake()
{
    PXR_Plugin.UPxr_InitAndroidClass();
    PXR_Plugin.System.UPxr_StartHomeKeyReceiver(gameObject.name);
}

//home key long pressed call back
public void setLongHomeKey()
{
    PXR_Plugin.Sensor.UPxr_OptionalResetSensor(1, 1);
}

I made minimal code that fix this behaviour, but why it cannot be called internally? This bridge seems very odd and extra. @PicoDevSupport

by (850 points)

And in Oculus Quest 2 it works as intended out from the library without building custom code for a specific platform.

by (44.8k points)

Hello, because these are customized interfaces based on Pico devices, not Unity XR universal interfaces. So you need to use pxrmanager.cs

by (850 points)

I think it's broken, because controller recenter works out of box but it doesn't recenter camera.
And it still doesn't give an answer why for making camera recenter works I need add special script when controller recenter works.

by (44.8k points)

Hello,
The function of long-pressing the home button to recenter is implemented through PXR_Manager to monitor the behavior of home button and cooperate with the system.

The reason we use this method is because there were developers who had requirements to modify the home button.

...