private SimpleWebXRHand GetOrAddHand(Handedness handedness) { if (trackedHands.ContainsKey(handedness)) { return(trackedHands[handedness]); } var pointers = RequestPointers(SupportedControllerType.ArticulatedHand, handedness); var inputSourceType = InputSourceType.Hand; IMixedRealityInputSystem inputSystem = Service as IMixedRealityInputSystem; var inputSource = inputSystem?.RequestNewGenericInputSource($"WebXR {handedness} Hand", pointers, inputSourceType); var handController = new SimpleWebXRHand(TrackingState.Tracked, handedness, inputSource); for (int i = 0; i < handController.InputSource?.Pointers?.Length; i++) { handController.InputSource.Pointers[i].Controller = handController; } inputSystem?.RaiseSourceDetected(handController.InputSource, handController); trackedHands.Add(handedness, handController); return(handController); }
private void RemoveHandDevice(SimpleWebXRHand hand) { if (hand == null) { return; } CoreServices.InputSystem?.RaiseSourceLost(hand.InputSource, hand); trackedHands.Remove(hand.ControllerHandedness); RecyclePointers(hand.InputSource); }