diff --git a/Assets/MRTK/Providers/Oculus/XRSDK/Controllers/OculusXRSDKTouchController.cs b/Assets/MRTK/Providers/Oculus/XRSDK/Controllers/OculusXRSDKTouchController.cs index 93252783a58..32f03c03068 100644 --- a/Assets/MRTK/Providers/Oculus/XRSDK/Controllers/OculusXRSDKTouchController.cs +++ b/Assets/MRTK/Providers/Oculus/XRSDK/Controllers/OculusXRSDKTouchController.cs @@ -108,9 +108,23 @@ protected override bool TryRenderControllerModel(System.Type controllerType, Inp } } - private async void TryRenderControllerModelFromOculus() + private void TryRenderControllerModelFromOculus() { - await WaitForOculusVisuals(); + OculusXRSDKDeviceManager deviceManager = CoreServices.GetInputSystemDataProvider(); + + if(deviceManager.IsNotNull()) + { + GameObject platformVisualization = null; + if (ControllerHandedness == Handedness.Left) + { + platformVisualization = deviceManager.leftControllerHelper.gameObject; + } + else if (ControllerHandedness == Handedness.Right) + { + platformVisualization = deviceManager.rightControllerHelper.gameObject; + } + RegisterControllerVisualization(platformVisualization); + } if (this != null) { @@ -127,18 +141,7 @@ private async void TryRenderControllerModelFromOculus() } } - private const int ControllerInitializationTimeout = 1000; - private async Task WaitForOculusVisuals() - { - int timeWaited = 0; - while (OculusControllerVisualization == null || timeWaited > ControllerInitializationTimeout) - { - await Task.Delay(100); - timeWaited += 100; - } - } - - internal void RegisterControllerVisualization(GameObject visualization) + private void RegisterControllerVisualization(GameObject visualization) { OculusControllerVisualization = visualization; if (GetControllerVisualizationProfile() != null && diff --git a/Assets/MRTK/Providers/Oculus/XRSDK/OculusXRSDKDeviceManager.cs b/Assets/MRTK/Providers/Oculus/XRSDK/OculusXRSDKDeviceManager.cs index 9ed381c0c19..d9803f3f6af 100644 --- a/Assets/MRTK/Providers/Oculus/XRSDK/OculusXRSDKDeviceManager.cs +++ b/Assets/MRTK/Providers/Oculus/XRSDK/OculusXRSDKDeviceManager.cs @@ -59,8 +59,8 @@ public override void Initialize() private readonly Dictionary trackedHands = new Dictionary(); private OVRCameraRig cameraRig; - private OVRControllerHelper leftControllerHelper; - private OVRControllerHelper rightControllerHelper; + internal OVRControllerHelper leftControllerHelper; + internal OVRControllerHelper rightControllerHelper; private OVRHand rightHand; private OVRSkeleton rightSkeleton; @@ -93,34 +93,6 @@ public override bool CheckCapability(MixedRealityCapability capability) #region Controller Utilities -#if OCULUSINTEGRATION_PRESENT - /// - protected override GenericXRSDKController GetOrAddController(InputDevice inputDevice) - { - GenericXRSDKController controller = base.GetOrAddController(inputDevice); - - if (!cameraRig.IsNull() && controller is OculusXRSDKTouchController oculusTouchController && oculusTouchController.OculusControllerVisualization == null) - { - GameObject platformVisualization = null; - if (oculusTouchController.ControllerHandedness == Handedness.Left) - { - platformVisualization = leftControllerHelper.gameObject; - } - if (oculusTouchController.ControllerHandedness == Handedness.Right) - { - platformVisualization = rightControllerHelper.gameObject; - } - - if(platformVisualization != null) - { - oculusTouchController.RegisterControllerVisualization(platformVisualization); - } - } - - return controller; - } -#endif - /// protected override Type GetControllerType(SupportedControllerType supportedControllerType) {