nicoco007 / BeatSaberCustomAvatars

Beat Saber mod that allows the use of custom player avatars for in-game body presence.
GNU Lesser General Public License v3.0
258 stars 41 forks source link

UnityXR loses Oculus controller tracking more easily than Generic Tracking #163

Open ibillingsley opened 6 days ago

ibillingsley commented 6 days ago

Using Beat Saber 1.37.1 and CustomAvatar 5.4.1 with Oculus Rift S

I noticed that the avatar loses tracking as soon as my controllers are out of view of the tracking cameras, even though the game continues to predict their position as seen here:

https://github.com/user-attachments/assets/0b8e1328-d800-4a02-8876-d5319c20cc05

Since I don't have any additional trackers, I recompiled the mod with a small code change to force the use of GenericDeviceProvider instead of UnityXRDeviceProvider.

------------ Source/CustomAvatar/Zenject/CustomAvatarsInstaller.cs ------------
index a6b9d0a..531d891 100644
@@ -77,7 +77,7 @@ namespace CustomAvatar.Zenject

             _logger.LogInformation($"Current Unity XR device: '{XRSettings.loadedDeviceName}'");

-            if (XRSettings.loadedDeviceName.IndexOf("OpenXR", StringComparison.OrdinalIgnoreCase) >= 0)
+            if (false)
             {
                 Container.Bind(typeof(IDeviceProvider), typeof(IInitializable), typeof(IDisposable)).To<UnityXRDeviceProvider>().AsSingle();

With GenericDeviceProvider the controllers continue to track even when they go out of direct view of the headset tracking cameras.

https://github.com/user-attachments/assets/1f53a83d-b2c8-40eb-a844-3358ed8cf428

If the UnityXR tracking can't do this, maybe an option could be added to choose which tracking provider to use?

nicoco007 commented 6 days ago

Hmm, that's odd. Do you have the Steam or the Meta/Oculus version of the game? Are you using SteamVR or Oculus as your OpenXR runtime?

ibillingsley commented 6 days ago

Steam version of the game with Oculus OpenXR runtime.

ibillingsley commented 5 days ago

Just to rule a couple things out, it makes no difference whether I have the XR Hands library installed. Also I had downgraded my oculus runtime LibOVRRTImpl dlls to fix haptics, but it behaves the same with the latest dlls as well.

edit: Same thing in BS 1.37.3 with CustomAvatars 5.4.4

nicoco007 commented 5 days ago

Thanks for the details! I'm guessing this has to do with how Oculus reports devices' isTracking value through OpenXR. I'll see what I can do.