예제 #1
0
    // this function is called when a left button has been pressed
    private void OnButtonDownLeft(ControllerInput.Button buttonID)
    {
#if INSTANTVR_ADVANCED
        if (walking && walkingType == WalkTypes.PointingTeleport && buttonID == leftHandMovements.activationButton)
        {
            // When activation button is pressed we teleport to the focus position
            PointingTeleport(pointingDevice);
        }

        if (fingerMovements == FingerMovements.ClickGrabbing && buttonID == ControllerInput.Button.Trigger2)
        {
            if (leftHandMovements.grabbedObject == null && !leftLettingGo)
            {
                leftHandMovements.thumbCurl  = 1;
                leftHandMovements.middleCurl = 1;
                leftHandMovements.ringCurl   = 1;
                leftHandMovements.littleCurl = 1;
                leftGrabbing = true;
            }
            else if (leftHandMovements.grabbedObject != null && !leftGrabbing)
            {
                leftHandMovements.thumbCurl  = 0;
                leftHandMovements.middleCurl = 0;
                leftHandMovements.ringCurl   = 0;
                leftHandMovements.littleCurl = 0;
                leftLettingGo = true;
            }
        }
#endif
    }
예제 #2
0
    // this function is called when a right button has been pressed
    private void OnButtonDownRight(ControllerInput.Button buttonID)
    {
        if (walking && walkingType == WalkTypes.Teleport && buttonID == ControllerInput.Button.ButtonA)
        {
            // When button One (A on Xbox controller) is pressed we teleport in the looking direction
            Teleport(ivr.transform.position + ivr.headTarget.transform.forward * 50 * Time.deltaTime);
        }
#if INSTANTVR_ADVANCED
        else if (walking && walkingType == WalkTypes.PointingTeleport && buttonID == rightHandMovements.activationButton)
        {
            // When activation button is pressed we teleport to the focus position
            PointingTeleport(pointingDevice);
        }

        if (fingerMovements == FingerMovements.ClickGrabbing && buttonID == ControllerInput.Button.Trigger2)
        {
            if (rightHandMovements.grabbedObject == null && !rightLettingGo)
            {
                rightHandMovements.thumbCurl  = 1;
                rightHandMovements.middleCurl = 1;
                rightHandMovements.ringCurl   = 1;
                rightHandMovements.littleCurl = 1;
                rightGrabbing = true;
            }
            else if (rightHandMovements.grabbedObject != null && !rightGrabbing)
            {
                rightHandMovements.thumbCurl  = 0;
                rightHandMovements.middleCurl = 0;
                rightHandMovements.ringCurl   = 0;
                rightHandMovements.littleCurl = 0;
                rightLettingGo = true;
            }
        }
#endif
    }
예제 #3
0
        public void PressButton(ControllerInput.Button buttonID)
        {
            switch (buttonID)
            {
            case ControllerInput.Button.ButtonA:
                buttons[0] = true;
                break;

            case ControllerInput.Button.ButtonB:
                buttons[1] = true;
                break;

            case ControllerInput.Button.ButtonX:
                buttons[2] = true;
                break;

            case ControllerInput.Button.ButtonY:
                buttons[3] = true;
                break;

            case ControllerInput.Button.Option:
                option = true;
                break;

            default:
                break;
            }
        }
예제 #4
0
 // this function is called when a button has been pressed
 void OnButtonDown(ControllerInput.Button buttonID)
 {
     if (buttonID == ControllerInput.Button.ButtonOne && walkingType == WalkTypes.Teleport)
     {
         // When button One (A on Xbox controller) is pressed we teleport in the looking direction;
         Teleport(character.headTarget.transform.forward * 50 * Time.deltaTime);
     }
 }
예제 #5
0
        public bool GetButton(ControllerInput.Button buttonID)
        {
            switch (buttonID)
            {
            case ControllerInput.Button.ButtonOne:
                return(buttons[0]);

            case ControllerInput.Button.ButtonTwo:
                return(buttons[1]);

            case ControllerInput.Button.ButtonThree:
                return(buttons[2]);

            case ControllerInput.Button.ButtonFour:
                return(buttons[3]);

            case ControllerInput.Button.Bumper:
                return(bumper > 0.9F);

            case ControllerInput.Button.Trigger:
                return(trigger > 0.9F);

            case ControllerInput.Button.StickButton:
                return(stickButton);

            case ControllerInput.Button.StickTouch:
                return(stickTouch);

            case ControllerInput.Button.Option:
                return(option);

            case ControllerInput.Button.Up:
                return(up);

            case ControllerInput.Button.Down:
                return(down);

            case ControllerInput.Button.Left:
                return(left);

            case ControllerInput.Button.Right:
                return(right);

            default:
                return(false);
            }
        }
예제 #6
0
        public bool GetButton(ControllerInput.Button buttonID)
        {
            switch (buttonID)
            {
            case ControllerInput.Button.ButtonA:
                return(buttons[0]);

            case ControllerInput.Button.ButtonB:
                return(buttons[1]);

            case ControllerInput.Button.ButtonX:
                return(buttons[2]);

            case ControllerInput.Button.ButtonY:
                return(buttons[3]);

            case ControllerInput.Button.Trigger1:
                return(trigger1 > 0.9F);

            case ControllerInput.Button.Trigger2:
                return(trigger2 > 0.9F);

            case ControllerInput.Button.StickButton:
                return(stickButton);

            case ControllerInput.Button.StickTouch:
                return(stickTouch);

            case ControllerInput.Button.Option:
                return(option);

            case ControllerInput.Button.Up:
                return(up);

            case ControllerInput.Button.Down:
                return(down);

            case ControllerInput.Button.Left:
                return(left);

            case ControllerInput.Button.Right:
                return(right);

            default:
                return(false);
            }
        }
예제 #7
0
    private void OnButtonUpRight(ControllerInput.Button buttonID)
    {
#if INSTANTVR_ADVANCED
        if (fingerMovements == FingerMovements.ClickGrabbing && buttonID == ControllerInput.Button.Trigger2)
        {
            if (rightLettingGo && rightHandMovements.grabbedObject == null)
            {
                rightLettingGo = false;
            }
            else if (rightGrabbing)
            {
                rightGrabbing = false;
                if (rightHandMovements.grabbedObject == null)
                {
                    rightHandMovements.thumbCurl  = 0;
                    rightHandMovements.middleCurl = 0;
                    rightHandMovements.ringCurl   = 0;
                    rightHandMovements.littleCurl = 0;
                }
            }
        }
#endif
    }
예제 #8
0
    private void OnButtonUpLeft(ControllerInput.Button buttonID)
    {
#if INSTANTVR_ADVANCED
        if (fingerMovements == FingerMovements.ClickGrabbing && buttonID == ControllerInput.Button.Trigger2)
        {
            if (leftLettingGo && leftHandMovements.grabbedObject == null)
            {
                leftLettingGo = false;
            }
            else if (leftGrabbing)
            {
                //Debug.Log("leftgrabbing FALSE");
                leftGrabbing = false;
                if (leftHandMovements.grabbedObject == null)
                {
                    leftHandMovements.thumbCurl  = 0;
                    leftHandMovements.middleCurl = 0;
                    leftHandMovements.ringCurl   = 0;
                    leftHandMovements.littleCurl = 0;
                }
            }
        }
#endif
    }
예제 #9
0
        public void EnableGazeInputModule(Transform cameraTransform, ControllerInput.Side inputSide, ControllerInput.Button activationButton, float autoActivation)
        {
            if (pointers == null)
            {
                pointers = new InteractionPointer[3]; // 0 = left index, 1 = right index, 2 = head
            }
            InteractionPointer pointer = new InteractionPointer(PointerType.Gaze, cameraTransform, eventSystem);

            pointer.focusingEnabled        = true; // gaze is always focusing
            pointer.localPointingDirection = Vector3.forward;
            pointer.focusTimeToTouch       = autoActivation;

            ControllerInput controllerInput = Controllers.GetController(0);

            if (controllerInput != null)
            {
                pointer.controllerInputSide = (inputSide == ControllerInput.Side.Left) ? controllerInput.left : controllerInput.right;
            }
            pointer.controllerButton = activationButton;

            pointers[(int)InputDeviceIDs.Head] = pointer;
        }