public void UpdateThumbPressDown(SteamVR_Behaviour_Boolean beh, SteamVR_Input_Sources src, bool pressed)
 {
     if (pressed)
     {
         move = true;
     }
 }
 public void UpdateThumbLiftUp(SteamVR_Behaviour_Boolean beh, SteamVR_Input_Sources src, bool lift)
 {
     if (!lift)
     {
         move = false;
     }
 }
Exemple #3
0
 private void Awake()
 {
     bb             = new SteamVR_Behaviour_Boolean();
     originPosition = handleOrigin.position;
     originRotation = handleOrigin.localRotation.eulerAngles;
     uy             = new Vector3(0f, 1f, 0f);
     axis           = new Vector3(1f, 0f, 0f);
     oldRotation    = Quaternion.Euler(0f, 0f, 0f);
     moveAction     = GameObject.Find("Game_Action").GetComponent <Move>();
 }
 public void PointGrabbed(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources source, bool state)
 {
     if (Physics.Raycast(transform.position, transform.forward, out RaycastHit hit, 20))
     {
         if (hit.transform.tag == "ControlPoint" || hit.transform.tag == "FixedPoint")
         {
             point = hit.transform.gameObject;
             relative.transform.position = point.transform.position;
         }
     }
 }
 public void GrabPressedDown(SteamVR_Behaviour_Boolean beh, SteamVR_Input_Sources src, bool pressed)
 {
     foreach (HandController.handCollision c in currentColliding)
     {
         InteractionInterface interact = c.col.GetComponent <InteractionInterface>();
         if (interact != null)
         {
             interact.grabPress(c.hand);
         }
     }
 }
 public void TurnRightPressDown(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources sources, bool state)
 {
     TurnRightPressed?.Invoke(this,
                              new ControllerInput.ControllerInteractionEventArgs
     {
         controllerReference =
             new PlayerController.ControllerReferenceArgs {
             hand = sources.SteamSourceToHand()
         }
     });
 }
 private void TriggerPressUp(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources sources, bool state)
 {
     TriggerReleased?.Invoke(this,
                             new ControllerInput.ControllerInteractionEventArgs
     {
         controllerReference =
             new PlayerController.ControllerReferenceArgs {
             hand = sources.SteamSourceToHand()
         }
     });
 }
Exemple #8
0
    private bool ValidInput(SteamVR_Behaviour_Boolean triggerInput)
    {
        if (_interactable.hoveringHand == null || !_interactable.isHovering)
        {
            return(false);
        }

        SteamVR_Input_Sources usingHandGameObject    = triggerInput.booleanAction.activeDevice;
        SteamVR_Input_Sources hoveringHandGameObject = _interactable.hoveringHand.handType;

        return(usingHandGameObject == hoveringHandGameObject);
    }
    private void MenuPressUp(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources sources, bool state)
    {
        Debug.Log("called menu press up " + sources);

        ButtonTwoReleased?.Invoke(this,
                                  new ControllerInput.ControllerInteractionEventArgs
        {
            controllerReference =
                new PlayerController.ControllerReferenceArgs {
                hand = sources.SteamSourceToHand()
            }
        });
    }
 public void RemovePoint(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources source, bool state)
 {
     if (Physics.Raycast(transform.position, transform.forward, out RaycastHit hit, 20))
     {
         if (hit.transform.tag == "ControlPoint")
         {
             pathRenderer.RemovePoint(hit.transform.GetSiblingIndex());
             DestroyImmediate(hit.transform.gameObject);
             pathRenderer.Recalculate();
             UIManager.instance.coordinatesPanel.SetActive(false);
         }
     }
 }
    private void TouchPadTouchDown(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources sources, bool state)
    {
        Debug.Log("called touchpad press down " + sources);

        TouchpadTouchPressed?.Invoke(this,
                                     new ControllerInput.ControllerInteractionEventArgs
        {
            controllerReference =
                new PlayerController.ControllerReferenceArgs {
                hand = sources.SteamSourceToHand()
            }
        });
    }
Exemple #12
0
    private IEnumerator SetupAction()
    {
        _triggerInput               = gameObject.AddComponent <SteamVRBooleanAction>();
        _triggerInput.inputSource   = SteamVR_Input_Sources.Any;
        _triggerInput.booleanAction = SteamVR_Actions._default.TriggerUse;
        _triggerInput.enabled       = false;

        yield return(null);

        _triggerInput.enabled     = true;
        _triggerInput.onPressDown = new SteamVR_Behaviour_BooleanEvent();
        _triggerInput.onPressUp   = new SteamVR_Behaviour_BooleanEvent();
        _triggerInput.onPressDown.AddListener(Use);
        _triggerInput.onPressUp.AddListener(UseStop);
    }
    public void ActionButtonPressed(SteamVR_Behaviour_Boolean beh, SteamVR_Input_Sources src, bool pressed)
    {
        if (!pressed)
        {
            return;
        }

        foreach (HandController.handCollision c in currentColliding)
        {
            InteractionInterface interact = c.col.GetComponent <InteractionInterface>();
            if (interact != null)
            {
                interact.interact(true, c.hand);
            }
        }
    }
Exemple #14
0
    private void UseStop(SteamVR_Behaviour_Boolean triggerInput, SteamVR_Input_Sources sources, bool state)
    {
        if (!_isUsing)
        {
            return;
        }

        Debug.Log("Use unpressed");

        _isUsing = false;

        ControllerInteraction.ControllerHand handContext = triggerInput.booleanAction.activeDevice.GetHand();

        InteractableObjectUnused?.Invoke(this,
                                         new ObjectInteraction.InteractableObjectEventArgs {
            interactingObject = gameObject, Hand = handContext
        });
    }
Exemple #15
0
    public void OnControllerGripPress(SteamVR_Behaviour_Boolean fromBehaviour, SteamVR_Input_Sources fromSource, System.Boolean state)
    {
        Debug.Log("OnControllerGripPress");
        if (fromSource == SteamVR_Input_Sources.LeftHand)
        {
            this.leftGripRelease = state;
        }
        if (fromSource == SteamVR_Input_Sources.RightHand)
        {
            this.rightGripRelease = state;
        }
        //Debug.Log(fromSource);
        //Debug.Log(state);

        if (this.leftGripRelease && this.rightGripRelease && !initialized)
        {
            this.Initialize();
        }
    }
Exemple #16
0
    private void Use(SteamVR_Behaviour_Boolean triggerInput, SteamVR_Input_Sources sources, bool state)
    {
        if (!ValidInput(triggerInput))
        {
            return;
        }

        Debug.Log("Use pressed on " + gameObject.name);

        if (!IsUsable)
        {
            return;
        }

        _isUsing = true;

        ControllerInteraction.ControllerHand handContext = triggerInput.booleanAction.activeDevice.GetHand();

        InteractableObjectUsed?.Invoke(this,
                                       new ObjectInteraction.InteractableObjectEventArgs {
            interactingObject = gameObject, Hand = handContext
        });
        Debug.Log("Used " + gameObject.name);
    }
Exemple #17
0
 /// <summary>
 /// Processes the event and re-emits the data via the <see cref="BooleanAction"/>.
 /// </summary>
 /// <param name="action">The action raising the event.</param>
 /// <param name="source">The source of the input.</param>
 /// <param name="value">The value of the raised event.</param>
 protected virtual void Listener(SteamVR_Behaviour_Boolean action, SteamVR_Input_Sources source, bool value)
 {
     Receive(value);
 }
Exemple #18
0
 private void Awake()
 {
     bb = new SteamVR_Behaviour_Boolean();
     hh = hand.GetComponent <HoldHandle>();
 }
 private void GripPressUp(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources sources, bool state)
 {
 }
 public void CreatePoint(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources source, bool state)
 {
     pathRenderer.AddPoint(transform.position);
     pathRenderer.Recalculate();
 }
 public void PointReleased(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources source, bool state)
 {
     point = null;
 }