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 }
private void Skeletal() { ulong restrictToDevice = 0; // Any Device for now Passer.EVRInputError err = Passer.OpenVR.Input.GetSkeletalActionData(actionHandle, ref tempSkeletonActionData, skeletonActionData_size, restrictToDevice); if (err != Passer.EVRInputError.None) { Debug.LogError("GetSkeletalActionData error: " + err.ToString() + ", handle: " + actionHandle.ToString()); return; } if (tempSkeletonActionData.bActive) { err = Passer.OpenVR.Input.GetSkeletalBoneData(actionHandle, Passer.EVRSkeletalTransformSpace.Parent, Passer.EVRSkeletalMotionRange.WithoutController, tempBoneTransforms, restrictToDevice); if (err != Passer.EVRInputError.None) { Debug.LogError("GetSkeletalBoneData error: " + err.ToString() + " handle: " + actionHandle.ToString()); } } }
public override void StartComponent(Transform trackerTransform) { base.StartComponent(trackerTransform); string actionName = isLeft ? "/actions/default/in/SkeletonLeftHand" : "/actions/default/in/SkeletonRightHand"; if (Passer.OpenVR.Input != null) { Passer.EVRInputError err = Passer.OpenVR.Input.GetActionHandle(actionName, ref actionHandle); if (err != Passer.EVRInputError.None) { Debug.LogError("OpenVR.Input.GetActionHandle error: " + err.ToString()); } skeletonActionData_size = (uint)Marshal.SizeOf(tempSkeletonActionData); GetInputActionHandles(); } else { Debug.Log("No OpenVR.Input"); } }