Ejemplo n.º 1
0
 private void updateBrushSize(Hand hand)
 {
     if (selectingBrushAction.GetAxisDelta(hand.handType).x >= 0.3f)
     {
         if (!didTick)
         {
             if (brushSize > 1)
             {
                 brushSize--;
                 didTick = true;
                 tileInteractor.setBrushSize(brushSize);
                 tileInteractor.brushSizeSlider.value = brushSize;
             }
         }
     }
     else if (selectingBrushAction.GetAxisDelta(hand.handType).x <= -0.3f)
     {
         if (!didTick)
         {
             if (brushSize < tileInteractor.brushSizeSlider.maxValue)
             {
                 brushSize++;
                 didTick = true;
                 tileInteractor.setBrushSize(brushSize);
                 tileInteractor.brushSizeSlider.value = brushSize;
             }
         }
     }
     else if (selectingBrushAction.GetAxisDelta(hand.handType).x == 0)
     {
         didTick = false;
     }
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        //Sets input values based on trackpad inputs
        TrackpadValueRight    = trackpadAction.GetAxis(SteamVR_Input_Sources.RightHand);
        TrackpadValueLeft     = trackpadAction.GetAxis(SteamVR_Input_Sources.LeftHand);
        trackpadLastValueLeft = trackpadAction.GetLastAxis(SteamVR_Input_Sources.LeftHand);
        TrackpackLeftChange   = trackpadAction.GetAxisDelta(SteamVR_Input_Sources.LeftHand);

        if (TrackpadValueLeft == Vector2.zero && trackpadLastValueLeft != Vector2.zero)
        {
            TrackpackLeftChange = Vector2.zero;
        }

        //Trigger pulled
        //TODO verify binding
        if (SteamVR_Input._default.inActions.GrabPinch.GetStateDown(SteamVR_Input_Sources.Any))
        {
            if (CollidedButton)
            {
                CollidedButton.onClick.Invoke();
            }


            if (CollidedObject)
            {
                //Move window
                connectedMediaWindow = CollidedObject.gameObject.GetComponent <MediaWindow>();
                connectedMediaWindow.WindowPickup();
            }
        }

        if (SteamVR_Input._default.inActions.GrabPinch.GetStateUp(SteamVR_Input_Sources.Any))
        {
            if (connectedMediaWindow)
            {
                Debug.Log("release");
                //Move window
                connectedMediaWindow.WindowRelease();
            }
        }
    }