コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
    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();
        }
    }
コード例 #3
0
    // 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;
         */
    }