private void AxesStateLabel(VRButton button) { var axes = VRInput.GetAxes(button); UnityGUI.Label(button.ToString() + " X: " + axes[0].ToString("0.000")); UnityGUI.Label(button.ToString() + " Y: " + axes[1].ToString("0.000")); }
public override void OnInspectorGUI() { BeginInspectorGUI(); if (events.arraySize > 0) { UnityGUI.Label("Events"); } UnityGUI.IndentLevel++; for (int i = 0; i < events.arraySize; i++) { var deleteIndex = DrawEvent(i); if (deleteIndex >= 0) { events.DeleteArrayElementAtIndex(deleteIndex); i--; } } UnityGUI.IndentLevel--; DrawAddEventButton(); EndInspectorGUI(); }
private void DrawVive() { UnityGUI.Space(); UnityGUI.Label("Vive_LeftController"); UnityGUI.IndentLevel++; var pos = VRInput.LeftHandPosition; var rot = VRInput.LeftHandRotation.eulerAngles; UnityGUI.BeginHorizontal(); UnityGUI.Label("Position X: " + pos.x.ToString("0.000")); UnityGUI.Label("Rotation X: " + rot.x.ToString("0.000")); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Position Y: " + pos.y.ToString("0.000")); UnityGUI.Label("Rotation Y: " + rot.y.ToString("0.000")); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Position Z: " + pos.z.ToString("0.000")); UnityGUI.Label("Rotation Z: " + rot.z.ToString("0.000")); UnityGUI.EndHorizontal(); ButtonStateLabel(VRButton.Vive_LeftMenu); ButtonStateLabel(VRButton.Vive_LeftTrackpad); ButtonStateLabel(VRButton.Vive_LeftTrigger); AxisStateLabel(VRButton.Vive_LeftTrigger); AxisStateLabel(VRButton.Vive_LeftGrip); AxesStateLabel(VRButton.Vive_LeftTrackpad); UnityGUI.IndentLevel--; UnityGUI.Space(); UnityGUI.Label("Vive_RightController"); UnityGUI.IndentLevel++; pos = VRInput.RightHandPosition; rot = VRInput.RightHandRotation.eulerAngles; UnityGUI.BeginHorizontal(); UnityGUI.Label("Position X: " + pos.x.ToString("0.000")); UnityGUI.Label("Rotation X: " + rot.x.ToString("0.000")); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Position Y: " + pos.y.ToString("0.000")); UnityGUI.Label("Rotation Y: " + rot.y.ToString("0.000")); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Position Z: " + pos.z.ToString("0.000")); UnityGUI.Label("Rotation Z: " + rot.z.ToString("0.000")); UnityGUI.EndHorizontal(); ButtonStateLabel(VRButton.Vive_RightMenu); ButtonStateLabel(VRButton.Vive_RightTrackpad); ButtonStateLabel(VRButton.Vive_RightTrigger); AxisStateLabel(VRButton.Vive_RightTrigger); AxisStateLabel(VRButton.Vive_RightGrip); AxesStateLabel(VRButton.Vive_RightTrackpad); UnityGUI.IndentLevel--; }
void OnGUI() { UnityGUI.Header("Coordinates"); headset = UnityGUI.Enum("Headset", headset); UnityGUI.Space(); UnityGUI.BeginHorizontal(); UnityGUI.Label(" ", "X", UnityGUI.BoldLabel); UnityGUI.Label("Y", UnityGUI.BoldLabel); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Resolution", headset.GetWidth().ToString()); UnityGUI.Label(headset.GetHeight().ToString()); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Field of View", ((int)headset.GetFieldOfView(Axis.Horizontal)).ToString()); UnityGUI.Label(((int)headset.GetFieldOfView(Axis.Vertical)).ToString()); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Diameter (um)", ((int)headset.GetRetinalDiameter(Axis.Horizontal)).ToString()); UnityGUI.Label(((int)headset.GetRetinalDiameter(Axis.Vertical)).ToString()); UnityGUI.EndHorizontal(); UnityGUI.Space(); Draw("Pixel", ref pixel); Draw("Visual Angle", ref angle); Draw("Retina (um)", ref retina); Draw("Polar", ref polar); UnityGUI.Separator(); UnityGUI.Header("Electrode Count"); UnityGUI.BeginChangeCheck(); pattern = UnityGUI.Enum("Pattern", pattern); layout = UnityGUI.Enum("Layout", layout); fieldOfView = UnityGUI.Float("Field of View", fieldOfView); var changed = UnityGUI.EndChangeCheck(); if (changed) { numElectrodes = pattern.GetElectrodePositions(layout, fieldOfView).Length; } UnityGUI.Space(); UnityGUI.Label("Electode Count", numElectrodes.ToString()); }
void OnGUI() { UnityGUI.Space(); _dataType = UnityGUI.Enum("Data Type", _dataType); UnityGUI.Space(); UnityGUI.Label("Parameters", UnityGUI.BoldLabel); _headset = UnityGUI.Enum("Headset Model", _headset); if (_dataType == DataType.Phosphene) { _pattern = UnityGUI.Enum("Electrode Pattern", _pattern); _layout = UnityGUI.Enum("Electrode Layout", _layout); } UnityGUI.Space(); _gpuAccel = UnityGUI.ToggleLeft("GPU Accelerated", _gpuAccel); if (UnityGUI.Button(!cpuStarted ? "Start" : "Stop", new GUIOptions { maxWidth = 50 })) { if (!cpuStarted) { Start(); } else { StopCPU(); } } if (threadGroup != null) { UnityGUI.Enabled = cpuStarted || !_gpuAccel; UnityGUI.Space(); UnityGUI.Label("CPU Threads", UnityGUI.BoldLabel); for (int i = 0; i < threadGroup.NumThreads; i++) { UnityGUI.Label("Thread " + i.ToString(), (threadGroup.Progress[i] * 100).ToString("N0") + "%"); } } }
private void ButtonStateLabel(VRButton button) { var state = "Up"; if (VRInput.GetButton(button)) { state = "Down"; } else if (VRInput.GetTouch(button)) { state = "Touching"; } else if (VRInput.GetHovering(button) > Mathf.Epsilon) { state = "Hovering"; } UnityGUI.Label(button.ToString() + ": " + state); }
private void DrawOculus() { UnityGUI.Space(); UnityGUI.Label("Rift_LeftController"); UnityGUI.IndentLevel++; var pos = VRInput.LeftHandPosition; var rot = VRInput.LeftHandRotation.eulerAngles; UnityGUI.BeginHorizontal(); UnityGUI.Label("Position X: " + pos.x.ToString("0.000")); UnityGUI.Label("Rotation X: " + rot.x.ToString("0.000")); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Position Y: " + pos.y.ToString("0.000")); UnityGUI.Label("Rotation Y: " + rot.y.ToString("0.000")); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Position Z: " + pos.z.ToString("0.000")); UnityGUI.Label("Rotation Z: " + rot.z.ToString("0.000")); UnityGUI.EndHorizontal(); ButtonStateLabel(VRButton.Rift_X); ButtonStateLabel(VRButton.Rift_Y); ButtonStateLabel(VRButton.Rift_Start); ButtonStateLabel(VRButton.Rift_LeftThumbstick); ButtonStateLabel(VRButton.Rift_LeftThumbRest); ButtonStateLabel(VRButton.Rift_LeftIndexTrigger); AxisStateLabel(VRButton.Rift_LeftIndexTrigger); AxisStateLabel(VRButton.Rift_LeftMiddleTrigger); AxesStateLabel(VRButton.Rift_LeftThumbstick); UnityGUI.IndentLevel--; UnityGUI.Space(); UnityGUI.Label("Rift_RightController"); UnityGUI.IndentLevel++; pos = VRInput.RightHandPosition; rot = VRInput.RightHandRotation.eulerAngles; UnityGUI.BeginHorizontal(); UnityGUI.Label("Position X: " + pos.x.ToString("0.000")); UnityGUI.Label("Rotation X: " + rot.x.ToString("0.000")); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Position Y: " + pos.y.ToString("0.000")); UnityGUI.Label("Rotation Y: " + rot.y.ToString("0.000")); UnityGUI.EndHorizontal(); UnityGUI.BeginHorizontal(); UnityGUI.Label("Position Z: " + pos.z.ToString("0.000")); UnityGUI.Label("Rotation Z: " + rot.z.ToString("0.000")); UnityGUI.EndHorizontal(); ButtonStateLabel(VRButton.Rift_A); ButtonStateLabel(VRButton.Rift_B); ButtonStateLabel(VRButton.Rift_RightThumbstick); ButtonStateLabel(VRButton.Rift_RightThumbRest); ButtonStateLabel(VRButton.Rift_RightIndexTrigger); AxisStateLabel(VRButton.Rift_RightIndexTrigger); AxisStateLabel(VRButton.Rift_RightMiddleTrigger); AxesStateLabel(VRButton.Rift_RightThumbstick); UnityGUI.IndentLevel--; }
private void AxisStateLabel(VRButton button) { UnityGUI.Label(button.ToString() + ": " + VRInput.GetAxis(button).ToString("0.000")); }