private void DeviceReloadButton(object sender, RoutedEventArgs e) { DeviceListView.Items.Clear(); for (uint i = 0; i < OpenVR.k_unMaxTrackedDeviceCount; i++) { string s = i.ToString() + " : " + util.GetSerialNumber(i); DeviceListView.Items.Add(s); } }
void Update() { bool run = false; foreach (var x in eovru.GetViveControllerIndexList()) { var rez = eovru.GetDevicePose(x); var t = eovru.GetTransform(x); var a = t.angularVelocity; var v = t.velocity; var p = t.position; var r = t.rotation; var s = eovru.GetSerialNumber(x); fp.Write(Time.time); fp.Write(","); fp.Write(s); fp.Write(","); fp.Write(p.x); fp.Write(","); fp.Write(p.y); fp.Write(","); fp.Write(p.z); fp.Write(","); fp.Write(v.x); fp.Write(","); fp.Write(v.y); fp.Write(","); fp.Write(v.z); fp.Write(","); fp.Write(r.eulerAngles.x); fp.Write(","); fp.Write(r.eulerAngles.y); fp.Write(","); fp.Write(r.eulerAngles.z); fp.Write(","); fp.Write(a.x); fp.Write(","); fp.Write(a.y); fp.Write(","); fp.Write(a.z); fp.Write(","); fp.Write(rez.eTrackingResult.ToString()); fp.Write(","); fp.WriteLine(); run = true; if (rez.eTrackingResult != Valve.VR.ETrackingResult.Running_OK) { eovru.TriggerHapticPulse(x); } } if (!run) { fp.Write(Time.time); fp.WriteLine(); } }