private void OnPadReleased(object sender, VRInputEventArgs e) { Debug.Log(e.HandRole + " Pad Released"); m_Inputs[Interaction.PadReleased] = e; m_Inputs[Interaction.PadPressed] = null; m_Inputs[Interaction.PadTouched] = null; }
//================================================================ //+---------------------------+ //| Check For Trigger Release | //+---------------------------+ private void CheckTriggerReleased(HandRole hr) { if (ViveInput.GetPressUp(hr, ControllerButton.Trigger)) { VRInputEventArgs args = new VRInputEventArgs(); args.ButtonPressed = ControllerButton.Trigger; args.HandRole = hr; args.Timestamp = DateTime.Now; OnTriggerReleased(args); } else if (ViveInput.GetPressUp(hr, ControllerButton.TriggerTouch)) { VRInputEventArgs args = new VRInputEventArgs(); args.ButtonPressed = ControllerButton.TriggerTouch; args.HandRole = hr; args.Timestamp = DateTime.Now; OnTriggerReleased(args); } else if (ViveInput.GetPressUp(hr, ControllerButton.FullTrigger)) { VRInputEventArgs args = new VRInputEventArgs(); args.ButtonPressed = ControllerButton.FullTrigger; args.HandRole = hr; args.Timestamp = DateTime.Now; OnTriggerReleased(args); } }
private void OnTriggerReleased(object sender, VRInputEventArgs e) { Debug.Log(e.HandRole + " Trigger Released"); m_Inputs[Interaction.TriggerReleased] = e; m_Inputs[Interaction.TriggerClicked] = null; m_Inputs[Interaction.TriggerTapped] = null; m_Inputs[Interaction.TriggerHeld] = null; }
//================================================================ //+---------------------+ //| Signal Pad Released | //+---------------------+ protected virtual void OnTriggerReleased(VRInputEventArgs e) { EventHandler <VRInputEventArgs> handler = TriggerReleased; if (handler != null) { handler(this, e); } }
//================================================================ //+--------------------+ //| Signal Pad Touched | //+--------------------+ protected virtual void OnPadTouched(VRInputEventArgs e) { EventHandler <VRInputEventArgs> handler = PadTouched; if (handler != null) { handler(this, e); } }
//================================================================ //+---------------------+ //| Signal Menu Pressed | //+---------------------+ protected virtual void OnMenuPressed(VRInputEventArgs e) { EventHandler <VRInputEventArgs> handler = MenuPressed; if (handler != null) { handler(this, e); } }
//================================================================ //+------------------------+ //| Check For Menu Release | //+------------------------+ private void CheckMenuReleased(HandRole hr) { if (ViveInput.GetPressUp(hr, ControllerButton.Menu)) { VRInputEventArgs args = new VRInputEventArgs(); args.ButtonPressed = ControllerButton.Menu; args.HandRole = hr; args.Timestamp = DateTime.Now; OnMenuReleased(args); } }
//================================================================ //+----------------------------------------------------+ //| Check For Trigger Clicked / Full Press / Full Hold | //+----------------------------------------------------+ private void CheckTriggerClicked(HandRole hr) { if (ViveInput.GetPressDown(hr, ControllerButton.FullTrigger)) { VRInputEventArgs args = new VRInputEventArgs(); args.ButtonPressed = ControllerButton.FullTrigger; args.HandRole = hr; args.Timestamp = DateTime.Now; OnTriggerClicked(args); } }
//+------------------------+ //| Check For Grip Pressed | //+------------------------+ private void CheckGripPressed(HandRole hr) { if (ViveInput.GetPress(hr, ControllerButton.Grip)) { VRInputEventArgs args = new VRInputEventArgs(); args.ButtonPressed = ControllerButton.Grip; args.HandRole = hr; args.Timestamp = DateTime.Now; OnGripPressed(args); } }
//================================================================ //+-----------------------+ //| Check For Pad Touched | //+-----------------------+ private void CheckPadTouched(HandRole hr) { if (ViveInput.GetPressDown(hr, ControllerButton.PadTouch)) { VRInputEventArgs args = new VRInputEventArgs(); args.ButtonPressed = ControllerButton.PadTouch; args.HandRole = hr; args.TouchCoordinates = ViveInput.GetPadAxis(hr); args.Timestamp = DateTime.Now; OnPadTouched(args); } }
//================================================================ //+-------------------------------------------------+ //| Signal Trigger Clicked / Full Press / Full Hold | //+-------------------------------------------------+ protected virtual void OnTriggerClicked(VRInputEventArgs e) { /* Activates If: * 1) Trigger if Held at least to 100% of the way * 2) Trigger is Pressed at least to 100% of the way */ EventHandler <VRInputEventArgs> handler = TriggerClicked; if (handler != null) { handler(this, e); } }
private void OnMenuReleased(object sender, VRInputEventArgs e) { Debug.Log(e.HandRole + " Menu Button Released"); m_Inputs[Interaction.MenuReleased] = e; m_Inputs[Interaction.MenuPressed] = null; }
private void OnGripReleased(object sender, VRInputEventArgs e) { Debug.Log(e.HandRole + " Grip Released"); m_Inputs[Interaction.GripReleased] = e; m_Inputs[Interaction.GripPressed] = null; }