Exemple #1
0
        private void GenericTimer(object sender, EventArgs e)
        {
            HmdMatrix34_t m = new HmdMatrix34_t();

            OpenVR.ChaperoneSetup.GetWorkingStandingZeroPoseToRawTrackingPose(ref m);

            RoomMatrixTextBox.Text =
                String.Format("{0:0.00}, {1:0.00}, {2:0.00}, {3:0.00}\n{4:0.00}, {5:0.00}, {6:0.00}, {7:0.00}\n{8:0.00}, {9:0.00}, {10:0.00}, {11:0.00}\n", m.m0, m.m1, m.m2, m.m3, m.m4, m.m5, m.m6, m.m7, m.m8, m.m9, m.m10, m.m11);
            if (
                m.m0 == 0 &&
                m.m1 == 0 &&
                m.m2 == 0 &&
                m.m3 == 0 &&
                m.m4 == 0 &&
                m.m5 == 0 &&
                m.m6 == 0 &&
                m.m7 == 0 &&
                m.m8 == 0 &&
                m.m9 == 0 &&
                m.m10 == 0 &&
                m.m11 == 0
                )
            {
                RoomMatrixTextBox.Background      = new SolidColorBrush(Color.FromRgb(255, 100, 100));
                SetRoomMatrixButtonName.IsEnabled = false;
            }
            else
            {
                RoomMatrixTextBox.Background      = new SolidColorBrush(Color.FromRgb(0, 255, 0));
                SetRoomMatrixButtonName.IsEnabled = true;
            }


            var t1 = util.GetTransformBySerialNumber("VMT_0");

            if (t1 != null)
            {
                string roomPos = string.Format("{0:0.00}, {1:0.00}, {2:0.00}", t1.position.X, t1.position.Y, t1.position.Z);

                //Unity座標系ではZが反転する
                if (CoordinateCombo.SelectedIndex == 1)
                {
                    roomPos = string.Format("{0:0.00}, {1:0.00}, {2:0.00}", t1.position.X, t1.position.Y, -t1.position.Z);
                }

                CheckPositionTextBox.Text = roomPos;
                if (roomPos == "1.00, 1.00, 1.00")
                {
                    CheckPositionTextBox.Background = new SolidColorBrush(Color.FromRgb(0, 255, 0));
                }
                else
                {
                    CheckPositionTextBox.Background = new SolidColorBrush(Color.FromRgb(255, 100, 100));
                }
            }
            var t2 = util.GetTransformBySerialNumberRaw("VMT_0");

            if (t2 != null)
            {
                CheckPositionRawTextBox.Text = string.Format("{0:0.00}, {1:0.00}, {2:0.00}", t2.position.X, t2.position.Y, t2.position.Z);
            }

            if (aliveCnt > 90)
            {
                installPath              = "";
                DriverVersion.Text       = "-";
                DriverVersion.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                ControlDock.IsEnabled    = false;
            }
            else
            {
                aliveCnt++;
            }

            InputVMTHapticTextBox.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
        }