Beispiel #1
0
    void Update()
    {
        if (walkingType == WalkTypes.SmoothWalking)
        {
            // move the character using the left analog stick
            float horizontal = 0;
            float vertical   = 0;

            // forward/backward walking using the left analog stick up/down
            if (walking)
            {
                vertical = controller0.left.stickVertical;
            }

            // left/right sidestepping using the left analog stick left/right
            if (sidestepping)
            {
                horizontal = controller0.left.stickHorizontal;
            }

            // now move the character
            character.Move(horizontal, 0, vertical);

            if (rotation)
            {
                // rotate the character using the right analog stick left/right
                horizontal = controller0.right.stickHorizontal * 10;
                character.Rotate(horizontal);
            }
        }
        // calibrate tracking when both left & right option buttons are pressed
        if ((controller0.left.option && controller0.right.option) || Input.GetKeyDown(KeyCode.Tab))
        {
            character.Calibrate();
        }

#if INSTANTVR_ADVANCED
        if (fingerMovements)
        {
            if (leftHandMovements)
            {
                leftHandMovements.thumbCurl  = controller0.left.trigger;
                leftHandMovements.indexCurl  = controller0.left.bumper;
                leftHandMovements.middleCurl = controller0.left.trigger;
                leftHandMovements.ringCurl   = controller0.left.trigger;
                leftHandMovements.littleCurl = controller0.left.trigger;
            }

            if (rightHandMovements)
            {
                rightHandMovements.thumbCurl  = controller0.right.trigger;
                rightHandMovements.indexCurl  = controller0.right.bumper;
                rightHandMovements.middleCurl = controller0.right.trigger;
                rightHandMovements.ringCurl   = controller0.right.trigger;
                rightHandMovements.littleCurl = controller0.right.trigger;
            }
        }
#endif
    }
Beispiel #2
0
    public void Update()
    {
        CheckQuit();

        if (walkingType == WalkTypes.SmoothWalking)
        {
            // move the character using the left analog stick
            float horizontal = 0;
            float vertical   = 0;

            // forward/backward walking using the left analog stick up/down
            if (walking)
            {
                vertical = controller0.left.stickVertical;
            }

            // left/right sidestepping using the left analog stick left/right
            if (sidestepping)
            {
                horizontal = controller0.left.stickHorizontal;
            }

            // now move the character
            if (walking || sidestepping)
            {
                ivr.Move(horizontal * Time.deltaTime, 0, vertical * Time.deltaTime);
            }

            if (rotation)
            {
                // rotate the character using the right analog stick left/right
                horizontal = controller0.left.stickHorizontal * 50;
                ivr.Rotate(horizontal * Time.deltaTime);
            }
        }
        // calibrate tracking when both left & right option buttons are pressed
        if ((controller0.left.option && controller0.right.option) || Input.GetKeyDown(KeyCode.Tab))
        {
            ivr.Calibrate();
        }

#if INSTANTVR_ADVANCED
        switch (fingerMovements)
        {
        case FingerMovements.Yes:
            UpdateFingerMovements();
            break;

        case FingerMovements.ClickGrabbing:
            UpdateFingerClickGrabbing();
            break;

        default:
            break;
        }
#endif
    }