Example #1
0
        private void ProcessPointer(InteractionPointer pointer, InputDeviceIDs inputDeviceID)
        {
            CastRayFromPointer(pointer, inputDeviceID);

            if (pointer.focusingEnabled && pointer.type == PointerType.Point)
            {
                pointer.ProcessFocus();
            }
            if (pointer.focusObject != null && pointer.focusTimeToTouch != 0 && Time.time - pointer.focusStart > pointer.focusTimeToTouch)   // we are clicking
            {
                pointer.ProcessTouch();
                pointer.ProcessNoTouch();
            }
            else if (pointer.clicking)
            {
                pointer.ProcessTouch();
            }

            if (pointer.data.pointerCurrentRaycast.gameObject == null)   // no focus
            {
                return;
            }

            pointer.data.pressPosition       = pointer.data.position;
            pointer.data.pointerPressRaycast = pointer.data.pointerCurrentRaycast;
            pointer.data.pointerPress        = null; //Clear this for setting later
            pointer.data.useDragThreshold    = true;

            if (pointer.type == PointerType.Touch)
            {
                // UI touch without colliders works on the finger tip
                float distance = DistanceTipToTransform(pointer.pointerTransform, pointer.data.pointerCurrentRaycast.gameObject.transform);
                if (distance < 0)   // we are touching
                {
                    pointer.ProcessTouch();
                }
                else if (distance > 0.05F)
                {
                    pointer.ProcessNoTouch();
                }
                else
                {
                    pointer.ProcessFocus();
                }
            }
        }
Example #2
0
        public void HandInteractionActivation(bool isLeft)
        {
            InteractionPointer pointer = isLeft ? pointers[(int)InputDeviceIDs.LeftHand] : pointers[(int)InputDeviceIDs.RightHand];

            if (pointer == null)
            {
                return;
            }

            pointer.ProcessTouch();
        }
Example #3
0
        public void OnFingerTouchStart(bool isLeft, GameObject obj)
        {
            InteractionPointer pointer = isLeft ? pointers[(int)InputDeviceIDs.LeftHand] : pointers[(int)InputDeviceIDs.RightHand];

            if (pointer == null)
            {
                return;
            }

            pointer.focusObject = obj;
            pointer.data.delta  = Vector3.zero;
            pointer.ProcessTouch();
        }