Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private void OnDisable()
 {
     DestroyCollider();
     InitHeadsetListeners(false);
     InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), false);
     InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), false);
 }
Exemplo n.º 3
0
        private void InitListeners(bool state)
        {
            InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state);
            InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state);

            InitTeleportListener(state);
            InitCollisionFadeListener(state);
        }
Exemplo n.º 4
0
        private void Awake()
        {
            touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged);
            touchpadUntouched   = new ControllerInteractionEventHandler(DoTouchpadTouchEnd);

            controllerLeftHand  = VRTK_DeviceFinder.GetControllerLeftHand();
            controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand();
        }
Exemplo n.º 5
0
        private void OnEnable()
        {
            CreateCollider();
            lastGoodPositionSet = false;
            headset             = VRTK_DeviceFinder.HeadsetTransform();
            StartCoroutine(WaitForHeadsetCollision(true));

            InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), true);
            InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), true);
        }
Exemplo n.º 6
0
        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);
                }
            }
        }