public void AppendDeviceInput(StringBuilder builder, IVRInputDevice inputDevice, string deviceName) { if (inputDevice == null) { return; } builder.AppendLine($"{deviceName} Back: {inputDevice.GetButton(VRButton.Back)}"); builder.AppendLine($"{deviceName} Button One: {inputDevice.GetButton(VRButton.Primary)}"); builder.AppendLine($"{deviceName} Touch Pad Touching: {inputDevice.IsTouching}"); builder.AppendLine($"{deviceName} Axis2D-One: {inputDevice.GetAxis2D(VRAxis.One)}"); builder.AppendLine($"{deviceName} Axis2D-OneRaw: {inputDevice.GetAxis2D(VRAxis.OneRaw)}"); }
public void AppendDeviceInput(StringBuilder builder, IVRInputDevice inputDevice, string deviceName) { if (inputDevice == null) { return; } builder.AppendLine($"{deviceName} Back: {inputDevice.GetButton(VRButton.Back)}"); builder.AppendLine($"{deviceName} Touch Pad Touching: {inputDevice.IsTouching}"); builder.AppendLine($"{deviceName} Trigger: {inputDevice.GetButton(VRButton.Trigger)}"); builder.AppendLine($"{deviceName} Primary: {inputDevice.GetButton(VRButton.Primary)}"); builder.AppendLine($"{deviceName} Seconday: {inputDevice.GetButton(VRButton.Seconday)}"); builder.AppendLine($"{deviceName} Three: {inputDevice.GetButton(VRButton.Three)}"); builder.AppendLine($"{deviceName} Four: {inputDevice.GetButton(VRButton.Four)}"); builder.AppendLine($"{deviceName} Axis One: {inputDevice.GetAxis2D(VRAxis.One)}"); builder.AppendLine($"{deviceName} Axis One Raw: {inputDevice.GetAxis2D(VRAxis.OneRaw)}"); builder.AppendLine($"{deviceName} Axis Two: {inputDevice.GetAxis1D(VRAxis.Two)}"); builder.AppendLine($"{deviceName} Axis Two Raw: {inputDevice.GetAxis1D(VRAxis.TwoRaw):0.00}"); builder.AppendLine($"{deviceName} Axis Three: {inputDevice.GetAxis1D(VRAxis.Three)}"); builder.AppendLine($"{deviceName} Axis Three Raw: {inputDevice.GetAxis1D(VRAxis.ThreeRaw):0.00}"); if (inputDevice.GetButtonUp(VRButton.Trigger)) { Debug.Log("Button up"); } //builder.AppendLine($"{deviceName} Axis2D-One: {inputDevice.GetAxis2D(VRAxis.One)}"); //builder.AppendLine($"{deviceName} Axis2D-OneRaw: {inputDevice.GetAxis2D(VRAxis.OneRaw)}"); }
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); }