Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     //Debug.Log("TRIGGER PRESENT");
     if (controller == null)
     {
         controller = GameObject.Find("RightHand").transform.GetChild(2).GetComponent <VRTK_ControllerEvents>();
         if (controller != null)
         {
             controller.GripPressed  += BoardObjectUsed;
             controller.GripReleased += BoardObjectUnused;
         }
     }
     if (controller != null)
     {
         //Debug.Log($"Trigger Axis {Input.GetAxis("RightTrigger")}");
         if (!triggered && Input.GetAxisRaw("RightTrigger") > 0.5)
         {
             triggered = true;
             controller.OnGripPressed(new ControllerInteractionEventArgs());
         }
         if (triggered && Input.GetAxisRaw("RightTrigger") < 0.5)
         {
             triggered = false;
             controller.OnGripReleased(new ControllerInteractionEventArgs());
         }
     }
 }
 public void GripPressed()
 {
     controllerEvents?.OnGripPressed(new ControllerInteractionEventArgs());
 }