private bool ControllersStillOverPreviousFloor() { if (playSpaceFallRestriction == FallingRestrictors.No_Restriction) { return(false); } var controllerDropThreshold = 0.05f; var rightController = VRTK_DeviceFinder.GetControllerRightHand(); var leftController = VRTK_DeviceFinder.GetControllerLeftHand(); var previousY = transform.position.y; var rightCheck = (rightController.activeInHierarchy && Mathf.Abs(ControllerHeightCheck(rightController) - previousY) < controllerDropThreshold); var leftCheck = (leftController.activeInHierarchy && Mathf.Abs(ControllerHeightCheck(leftController) - previousY) < controllerDropThreshold); if (playSpaceFallRestriction == FallingRestrictors.Left_Controller) { rightCheck = false; } if (playSpaceFallRestriction == FallingRestrictors.Right_Controller) { leftCheck = false; } if (playSpaceFallRestriction == FallingRestrictors.Both_Controllers) { return(rightCheck && leftCheck); } return(rightCheck || leftCheck); }
private void OnDisable() { DestroyCollider(); InitHeadsetListeners(false); InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), false); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), false); }
private void InitListeners(bool state) { InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state); InitTeleportListener(state); InitCollisionFadeListener(state); }
private void Awake() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); }
private void OnEnable() { CreateCollider(); lastGoodPositionSet = false; headset = VRTK_DeviceFinder.HeadsetTransform(); StartCoroutine(WaitForHeadsetCollision(true)); InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), true); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), true); }
private void InitDestinationMarkerListeners(bool state) { var leftHand = VRTK_DeviceFinder.GetControllerLeftHand(); var rightHand = VRTK_DeviceFinder.GetControllerRightHand(); InitDestinationSetListener(leftHand, state); InitDestinationSetListener(rightHand, state); foreach (var destinationMarker in VRTK_ObjectCache.registeredDestinationMarkers) { if (destinationMarker.gameObject != leftHand && destinationMarker.gameObject != rightHand) { InitDestinationSetListener(destinationMarker.gameObject, state); } } }