public void StartTracker() { if (!enabled || UnityVRDevice.xrDevice != UnityVRDevice.XRDeviceType.OpenVR) { return; } TraditionalDevice.gameControllerEnabled = false; // Game controllers interfere with OpenVR Controller Input ... :-( OpenVRDevice.Start(); }
public override void StartTracker(HumanoidControl _humanoid) { humanoid = _humanoid; if (humanoid.headTarget.unityVRHead.enabled && UnityVRDevice.xrDevice == UnityVRDevice.XRDeviceType.OpenVR) { enabled = true; } if (!enabled || UnityVRDevice.xrDevice != UnityVRDevice.XRDeviceType.OpenVR) { return; } TraditionalDevice.gameControllerEnabled = false; // Game controllers interfere with OpenVR Controller Input ... :-( OpenVRDevice.Start(); AddTracker(humanoid, "OpenVR"); #if UNITY_EDITOR string path = Application.dataPath + humanoid.path + "/Extensions/OpenVR/actions.json"; #else string path = Application.dataPath + "/../actions.json"; #endif Passer.EVRInputError err = Passer.OpenVR.Input.SetActionManifestPath(path); if (err != Passer.EVRInputError.None) { Debug.LogError("OpenVR.Input.SetActionManifestPath error (" + path + "): " + err.ToString()); } else { err = Passer.OpenVR.Input.GetActionSetHandle("/actions/default", ref pHandle); if (err != Passer.EVRInputError.None) { Debug.LogError("OpenVR.Input.GetActionSetHandle error (): " + err.ToString()); } else { actionSet.ulActionSet = pHandle; } } activeActionSets = new Passer.VRActiveActionSet_t[] { actionSet }; activeActionSetSize = (uint)(Marshal.SizeOf(typeof(Passer.VRActiveActionSet_t))); OpenVRDevice.onNewSensor = OnNewSensor; #if hVIVETRACKER Debug.Log("Detecting Vive Tracker positions.\nMake sure the Vive HMD is looking in the same direction as the user!"); #endif }