Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        // 時間
        time += Time.deltaTime;

        if (time >= 5.0f)
        {
            // 過去の座標と車の今の座標
            float distance = Vector3.Distance(lastPos, buggycontrol.GetPos());

            // 動いたかどうかを判別するための変数
            float error = 1.0f;

            // スピードを取得
            Vector3 speed = buggycontrol.GetSpeed();

            // 速度が1でもあれば動いている
            if (Vector3.Distance(Vector3.zero, speed) > error)
            {
                // 座標と角度を格納する
                lastPos = buggycontrol.GetPos();
                lastRot = buggycontrol.GetRot();
            }

            time = 0.0f;
        }

        if (fade.GetAlfa())
        {
            // 先頭の要素の座標にセットする
            buggycontrol.SetPos(lastPos);
            buggycontrol.SetRot(lastRot);
            //buggycontrol.SetVertical(0.0f);
        }
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        // 車の情報
        buggycontrol = car.GetComponent <BuggyControl>();

        lastPos = buggycontrol.GetPos();

        lastRot = buggycontrol.GetRot();
    }