public void TriggerVibration() { OVRHapticsClip clip = new OVRHapticsClip(AudioManager.instance.GetTriggerClip()); IVRInputDevice rightInput = GetInput(VRInputDeviceHand.Right); IVRInputDevice leftInput = GetInput(VRInputDeviceHand.Left); if (leftInput.GetButtonDown(VRButton.One)) { OVRInput.SetControllerVibration(0.6f, 0.4f, (OVRInput.Controller)VRInputDeviceHand.Left); } if (rightInput.GetButtonDown(VRButton.One)) { OVRInput.SetControllerVibration(0.6f, 0.4f, (OVRInput.Controller)VRInputDeviceHand.Right); } }
public bool GetButton(IVRInputDevice device, List <EButtonType> buttonTypes, EButtonState state) { foreach (var eButtonType in buttonTypes) { switch (eButtonType) { case EButtonType.MiddleMouse: case EButtonType.LeftMouse: case EButtonType.RightMouse: var mouseNumber = GetMouseNumber(eButtonType); if (UnityEngine.Input.GetMouseButtonDown(mouseNumber) && state == EButtonState.Down) { return(true); } if (UnityEngine.Input.GetMouseButton(mouseNumber) && state == EButtonState.Pressed) { return(true); } if (UnityEngine.Input.GetMouseButtonUp(mouseNumber) && state == EButtonState.Up) { return(true); } break; default: if (state == EButtonState.Down && device.GetButtonDown(ToVRButton(eButtonType))) { return(true); } if (state == EButtonState.Pressed && device.GetButton(ToVRButton(eButtonType))) { return(true); } if (state == EButtonState.Up && device.GetButtonUp(ToVRButton(eButtonType))) { return(true); } break; } } return(false); }
public override bool GetButtonDown() { return(mInputDevice.GetButtonDown(VRButton.One)); }