diff --git a/Runtime/HumanoidControl/Scripts/Extensions/UnityXR/UnityXRController.cs b/Runtime/HumanoidControl/Scripts/Extensions/UnityXR/UnityXRController.cs index cd54ada..a042e37 100644 --- a/Runtime/HumanoidControl/Scripts/Extensions/UnityXR/UnityXRController.cs +++ b/Runtime/HumanoidControl/Scripts/Extensions/UnityXR/UnityXRController.cs @@ -11,6 +11,12 @@ namespace Passer.Tracking { protected XRNode xrNode; + protected enum LoadedDeviceType { + None, + Oculus, + OpenXR, + } + protected LoadedDeviceType loadedDevice = LoadedDeviceType.None; public GameObject model; #region Manage @@ -130,6 +136,12 @@ namespace Passer.Tracking { InputDevices.deviceConnected += OnDeviceConnected; InputDevices.deviceDisconnected += OnDeviceDisconnected; + + if (XRSettings.loadedDeviceName == "oculus display") + loadedDevice = LoadedDeviceType.Oculus; + else if (XRSettings.loadedDeviceName == "OpenXR Display") + loadedDevice = LoadedDeviceType.OpenXR; + } /// @@ -188,6 +200,8 @@ namespace Passer.Tracking { Quaternion rotation; if (isTracked && device.TryGetFeatureValue(CommonUsages.deviceRotation, out rotation)) { + if (loadedDevice == LoadedDeviceType.OpenXR) + rotation *= Quaternion.AngleAxis(45, Vector3.right); transform.rotation = trackerTransform.rotation * rotation; rotationConfidence = 1; status = Tracker.Status.Tracking;