コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (oe.evaluationNum == 1)
        {
            s.SetActive(true);
        }
        else
        {
            s.SetActive(false);
        }

        if (oe.Set_PointFlag())
        {
            cc.Change_Color(1);
        }
        else
        {
            cc.Change_Color(0);
        }
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        // yama 181224 DeviceContoroll.csに評価を行う提示パターンを受け渡し
        if (prePattern != feedbackPattern)
        {
            dc.Set_FeedbackPattern(feedbackPattern);
            prePattern = feedbackPattern;
        }

        // yama 181228 練習環境から切り替わった際,評価対象のオブジェクトはここで選択される
        if (objT == null)
        {
            objT = oe.Set_EvaluationObject(eNum);

            if (objT.activeSelf)
            {
                Get_EvaluationObj(objT);
            }
        }

        // yama 190201 実験1実施時
        if (eNum == 1)
        {
            // yama 190201 実験実施時はコントローラ,デバックや動作確認の際はキーボードで仮想物体の切り替え
            if (OVRInput.GetDown(OVRInput.RawButton.LIndexTrigger) || Input.GetKeyDown(KeyCode.Space))
            {
                if (contactP)
                {
                    if (!oe.Set_PointFlag())
                    {
                        #region ファイルに出力するための変数を集め,合体

                        string  pene    = dc.Set_PenetrationDistance(); // yama 181120 現在のめり込み量を取得
                        string  peneY   = dc.Set_PenetYDistance();      // yama 181120 現在のY軸方向のめり込み量を取得
                        Vector3 tipPos  = dc.Set_tipD();                // yama 190201 現フレームのデバイス先端座標
                        Vector3 hitPos  = dc.Set_hitO();                // yama 190201 現フレームのデバイスの方向ベクトルと仮想ぶった表面の交点(真値)
                        double  sitaRV  = dc.Set_AngleRVNormal();       // yama 190201 接触点の法線と床の法線とのなす角
                        double  sitaDeV = dc.Set_AngleDeVNormal();      // yama 190201 接触点の法線とデバイスの方向ベクトルのなす角
                        double  sitaDeR = dc.Set_AngleDeRNormal();      // yama 190201 床の法線とデバイスの方向ベクトルのなす角
                        string  txt     = pene + "," + peneY + ",,," + tipPos.x + "," + tipPos.y + "," + tipPos.z + ",,," + +hitPos.x + "," + hitPos.y + "," + hitPos.z + ",," + sitaRV + "," + sitaDeV + "," + sitaDeR;

                        Text_Save(txt);

                        #endregion

                        objP.GetComponent <ChangeObjColor>().Change_Color(0);

                        oe.Set_NextEvaluation();

                        timer.Stop();
                        timer.Reset();
                    }
                }
                else
                {
                    Debug.Log("ERROR:ポイントに対して接触していません.");
                }
            }

            // yama 190201 デバックや動作確認時,途中で終了するとそれまでのデータが保存されないので,強制終了用
            if (Input.GetKeyDown(KeyCode.M))
            {
                swIn.Flush();
                swIn.Close();
                Debug.Log("Save Finish");
            }

            contactP = false;
        }
        // yama 190201 実験2実施時
        else if (eNum == 2)
        {
            // yama 190201 実験実施時はコントローラ,デバックや動作確認の際はキーボードで仮想物体の切り替え
            if (OVRInput.GetDown(OVRInput.RawButton.LIndexTrigger) || Input.GetKeyDown(KeyCode.Space))
            {
                objT = oe.Set_EvaluationObject(eNum);

                if (objT.activeSelf)
                {
                    Debug.Log("Name: " + objT.name);
                    Get_EvaluationObj(objT);
                }
            }

            if (start)
            {
                #region ファイルに出力するための変数を集め,合体

                string  pene    = dc.Set_PenetrationDistance(); // yama 181120 現在のめり込み量を取得
                string  peneY   = dc.Set_PenetYDistance();      // yama 181120 現在のY軸方向のめり込み量を取得
                Vector3 tipPos  = dc.Set_tipD();
                Vector3 hitPos  = dc.Set_hitO();
                double  sitaRV  = dc.Set_AngleRVNormal();
                double  sitaDeV = dc.Set_AngleDeVNormal();
                double  sitaDeR = dc.Set_AngleDeRNormal();
                string  txt     = pene + "," + peneY + ",,," + tipPos.x + "," + tipPos.y + "," + tipPos.z + ",,," + +hitPos.x + "," + hitPos.y + "," + hitPos.z + ",," + sitaRV + "," + sitaDeV + "," + sitaDeR;

                Text_Save(txt);

                #endregion
            }
        }
    }