private void HapticTestButton(object sender, RoutedEventArgs e) { var index = GetInputIndex(); if (index.ok) { var deviceIndex = util.GetDeviceIndexBySerialNumber("VMT_" + index.i); if (deviceIndex != EasyOpenVRUtil.InvalidDeviceIndex) { util.TriggerHapticPulse(deviceIndex); } } }
void Start() { eou = new EasyOpenVRUtil(); eou.StartOpenVR(); uint idx = eou.GetDeviceIndexBySerialNumber(serial); foreach (ETrackedDeviceProperty prop in Enum.GetValues(typeof(ETrackedDeviceProperty))) { bool ok = false; var name = prop.ToString(); bool resultBool; if (eou.GetPropertyBool(idx, prop, out resultBool)) { log += (name + " : " + resultBool); ok = true; } float resultFloat; if (eou.GetPropertyFloat(idx, prop, out resultFloat)) { log += (name + " : " + resultFloat); ok = true; } int resultInt32; if (eou.GetPropertyInt32(idx, prop, out resultInt32)) { log += (name + " : " + resultInt32); ok = true; } ulong resultUint64; if (eou.GetPropertyUint64(idx, prop, out resultUint64)) { log += (name + " : " + resultUint64); ok = true; } string resultString; if (eou.GetPropertyString(idx, prop, out resultString)) { log += (name + " : " + resultString); ok = true; } if (ok) { log += "\n"; } } Debug.Log(log); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Q)) { Debug.Log("!"); } if (Input.GetKeyDown(KeyCode.A)) { Debug.Log(eou.Init()); } if (Input.GetKeyDown(KeyCode.W)) { Debug.Log(eou.StartOpenVR()); } if (Input.GetKeyDown(KeyCode.S)) { Debug.Log(eou.TakeScreenShot("D:\\tmp\\test", "D:\\tmp\\test2")); } if (Input.GetKeyDown(KeyCode.X)) { Debug.Log(eou.GetDeviceIndexBySerialNumber("LHR-72214A13")); } if (Input.GetKeyDown(KeyCode.Z)) { eou.Update(); Debug.Log(eou.PutDeviceInfoListString()); } if (Input.GetKeyDown(KeyCode.V)) { Debug.Log(eou.PutDeviceInfoListStringFromDeviceIndexList(eou.GetDeviceIndexListByRegisteredDeviceType("tracker"))); Debug.Log(eou.PutDeviceInfoListStringFromDeviceIndexList(eou.GetDeviceIndexListByRenderModelName("tracker"))); } if (Input.GetKeyDown(KeyCode.N)) { Debug.Log(eou.TriggerHapticPulse(eou.GetLeftControllerIndex())); Debug.Log(eou.TriggerHapticPulse(eou.GetRightControllerIndex())); } if (Input.GetKeyDown(KeyCode.B)) { Debug.Log("Controller"); Debug.Log(eou.PutDeviceInfoListStringFromDeviceIndexList(eou.GetViveControllerIndexList())); Debug.Log("Tracker"); Debug.Log(eou.PutDeviceInfoListStringFromDeviceIndexList(eou.GetViveTrackerIndexList())); Debug.Log("BaseStation"); Debug.Log(eou.PutDeviceInfoListStringFromDeviceIndexList(eou.GetBaseStationIndexList())); } if (Input.GetKeyDown(KeyCode.Y)) { } /* * Vector3 pos; * Quaternion rot; * eou.GetHMDPose(out pos, out rot); * obj.transform.position = pos; * obj.transform.rotation = rot; * * eou.GetPoseBySerialNumber("LHR-72214A13", out pos, out rot); * obj2.transform.position = pos; * obj2.transform.rotation = rot; * * Vector3 pos2; * Quaternion rot2; * eou.GetControllerPose(out pos, out rot, out pos2, out rot2); * obj3.transform.position = pos; * obj3.transform.rotation = rot; * * obj4.transform.position = pos2; * obj4.transform.rotation = rot2; */ }