// Update is called once per frame
    void Update()
    {
        MenuDown = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("Menu").GetStateDown(InputSource);
        Menu     = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("Menu").GetState(InputSource);
        MenuUp   = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("Menu").GetStateUp(InputSource);

        TriggerDown = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("GrabPinch").GetStateDown(InputSource);
        Trigger     = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("GrabPinch").GetState(InputSource);
        TriggerUp   = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("GrabPinch").GetStateUp(InputSource);

        TouchPadDown = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("TouchPad").GetStateDown(InputSource);
        TouchPad     = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("TouchPad").GetState(InputSource);
        TouchPadUp   = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("TouchPad").GetStateUp(InputSource);

        TouchClicDown = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("Teleport").GetStateDown(InputSource);
        TouchClic     = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("Teleport").GetState(InputSource);
        TouchClicUp   = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("Teleport").GetStateUp(InputSource);

        GripDown = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("GrabGrip").GetStateDown(InputSource);
        Grip     = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("GrabGrip").GetState(InputSource);
        GripUp   = SteamVR_Input.GetAction <SteamVR_Action_Boolean>("GrabGrip").GetStateUp(InputSource);



        Squeeze = SteamVR_Input.GetSingleAction("Squeeze").GetAxis(InputSource);
        //Squeeze = (float)System.Math.Round(Squeeze , 2);
        if (Squeeze <= 0.05f)
        {
            Squeeze = 0;
        }

        TouchPos = SteamVR_Input.GetVector2Action("TouchPos").GetAxis(InputSource);
        //TouchPos = new Vector2 ((float)System.Math.Round(TouchPos.x , 2) , (float)System.Math.Round(TouchPos.y , 2) );

        /*
         * if (Menu) print("Menu");
         * if (MenuUp) print("MenuUp");
         * if (MenuDown) print("MenuDown");
         * if (Trigger) print("Trigger");
         * if (TriggerUp) print("TriggerUp");
         * if (TriggerDown) print("TriggerDown");
         * if (TouchPad) print("TouchPad");
         * if (TouchPadUp) print("TouchPadUp");
         * if (TouchPadDown) print("TouchPadDown");
         * if (TouchClic) print("TouchClic");
         * if (TouchClicUp) print("TouchClicUp");
         * if (TouchClicDown) print("TouchClicDown");
         * if (Grip) print("Grip");
         * if (GripUp) print("GripUp");
         * if (GripDown) print("GripDown");
         */
    }
Ejemplo n.º 2
0
 void listenForFlightModeTriggerAndSavePosition()
 {
     // Check if trigger value is 1.0 (pulled completely) and was not last active (first time triggered)
     //Debug.Log(SteamVR_Input.GetSingleAction("FlyingTrigger").GetAxis(SteamVR_Input_Sources.LeftHand));
     //Debug.Log(SteamVR_Input.GetSingleAction("FlyingTrigger").GetChanged(SteamVR_Input_Sources.LeftHand));
     if (SteamVR_Input.GetSingleAction("FlyingTrigger").GetAxis(SteamVR_Input_Sources.LeftHand) >= 1.0f &&
         SteamVR_Input.GetSingleAction("FlyingTrigger").GetChanged(SteamVR_Input_Sources.LeftHand))
     {
         initialPos   = leftHand.transform.localPosition;
         initialRot   = leftHand.transform.localRotation;
         isflightMode = true;
     }
     else if (isflightMode && SteamVR_Input.GetSingleAction("FlyingTrigger").GetAxis(SteamVR_Input_Sources.LeftHand) < 1.0f)
     {
         isflightMode = false;
     }
 }
Ejemplo n.º 3
0
 public float GetValue(SteamVR_Input_Sources source)
 {
     return(SteamVR_Input.GetSingleAction("default", inputName).GetAxis(source));
 }