1using System.Collections.Generic;
4using UnityEngine.InputSystem;
12 [DisallowMultipleComponent]
15 [Header(
"Input Actions")]
16 [SerializeField, Tooltip(
"Calibrate the rotations of all vive trackers. Hold them upright in the center of the CAVERN and pointed towards the center of the screen.")]
17 private InputAction calibrate =
new(
"Calibrate", InputActionType.Value,
"<Keyboard>/c");
20 private int numViveTrackers = 0;
21 private int numViveControllers = 0;
22 private readonly List<string> trackerRoles =
new();
23 private readonly List<string> controllerRoles =
new();
27 (calibrate.GetBindingDisplayString(),
"Calibrate the rotation of all vive trackers."),
34 if (numViveTrackers > 0)
36 GUILayout.Label($
"Vive Trackers: {numViveTrackers}");
37 GUILayout.Label($
"Tracker roles: {string.Join(",
", trackerRoles)}");
39 if (numViveControllers > 0)
41 GUILayout.Label($
"Vive Controllers: {numViveControllers}");
42 GUILayout.Label($
"Controller roles: {string.Join(",
", controllerRoles)}");
64 calibrate.performed += CalibrateAction;
67 foreach (ViveTracker tracker
in FindObjectsByType<ViveTracker>(FindObjectsSortMode.None))
70 ViveTracker.SteamVRPoseBindings binding = tracker.binding;
71 trackerRoles.Add(ViveTracker.GetReadableName(binding));
73 foreach (ViveController controller
in FindObjectsByType<ViveController>(FindObjectsSortMode.None))
76 ViveController.Role role = controller.role;
77 controllerRoles.Add(ViveController.GetReadableRoleName(role));
81 void CalibrateAction(InputAction.CallbackContext ctx)
83 foreach (GameObject tracker
in GameObject.FindGameObjectsWithTag(
"ViveTracker"))
85 tracker.GetComponent<ViveTracker>().Calibrate();
Helpful debug information (both keyboard shortcuts and GUI) for Vive Trackers. This also adds the abi...
List<(string Key, string Description)> KeyDescriptions()