private bool isGraspAxisConfigured(InteractionXRController controller) { try { Input.GetAxis(controller.graspButtonAxis); return(true); } catch (ArgumentException) { return(false); } }
private void checkInteractionVRControllerStatus(InteractionXRController controller, List <ControllerStatusMessage> messages) { // Check if the controller is configured correctly if it is set up with a custom // tracking provider. if (controller.isUsingCustomTracking) { messages.Add(new ControllerStatusMessage() { message = "Custom Tracking Provider", tooltip = "You are using a custom tracking provider for this VR controller.", color = Colors.Caution }); } // Check if the player has duplicate VRNode left controllers or right controllers. bool isLeftVRNodeController = controller.trackingProvider is DefaultXRNodeTrackingProvider && controller.chirality == Chirality.Left; bool isRightVRNodeController = controller.trackingProvider is DefaultXRNodeTrackingProvider && controller.chirality == Chirality.Right; if (isLeftVRNodeController && _leftVRNodeController != null || isRightVRNodeController && _rightVRNodeController != null) { var alreadyExistsController = isLeftVRNodeController ? _leftVRNodeController : _rightVRNodeController; string message; string tooltip; Color color; if (controller.deviceJoystickTokens.Equals(alreadyExistsController.deviceJoystickTokens)) { message = "Duplicate VR Controller"; tooltip = "You already have a VRNode controller with this chirality and device " + "string in your scene. You should remove one of the duplicates."; color = Colors.Problem; } else { message = "Multiple VR Controllers"; tooltip = "You have multiple VR controllers of the same chirality enabled with " + "different device strings. If both device strings match attached " + "Unity joysticks, you may get duplicate controllers."; color = Colors.Caution; } messages.Add(new ControllerStatusMessage() { message = message, tooltip = tooltip, color = color }); } if (isLeftVRNodeController) { _leftVRNodeController = controller; } if (isRightVRNodeController) { _rightVRNodeController = controller; } string wrongChiralityToken = controller.isLeft ? "right" : "left"; if (controller.deviceJoystickTokens.Contains(wrongChiralityToken)) { messages.Add(new ControllerStatusMessage() { message = "Wrong Chirality?", tooltip = "This VR controller's device joystick string specifies a chirality " + "that is different from the chirality of the controller itself. You " + "should confirm this controller's device string or chirality setting.", color = Colors.Warning }); } }