예제 #1
0
    void FixedUpdate()
    {
        switch (ejercicio)
        {
        case Funciones.Uno:
            Vector3Debugger.EnableEditorView("primero");
            Vector3Debugger.DisableEditorView("segundo");
            Vector3Debugger.DisableEditorView("tercero");

            // ---------------

            MyQuatern miQuat1 = MyQuatern.Euler(0, valor, 0);

            ejer1 = (miQuat1 * new Vec3(ejer1));

            // ---------------

            Vector3Debugger.UpdatePosition("primero", ejer1);

            break;

        case Funciones.Dos:
            Vector3Debugger.EnableEditorView("segundo");
            Vector3Debugger.DisableEditorView("primero");
            Vector3Debugger.DisableEditorView("tercero");

            // ---------------

            MyQuatern miQuat2 = MyQuatern.Euler(0, valor, 0);

            ejer2[1] = (miQuat2 * new Vec3(ejer2[1]));
            ejer2[2] = (miQuat2 * new Vec3(ejer2[2]));
            ejer2[3] = (miQuat2 * new Vec3(ejer2[3]));

            // ---------------

            Vector3Debugger.UpdatePositionsSecuence("segundo", ejer2);

            break;

        case Funciones.Tres:
            Vector3Debugger.EnableEditorView("tercero");
            Vector3Debugger.DisableEditorView("primero");
            Vector3Debugger.DisableEditorView("segundo");

            // ---------------

            MyQuatern miQuat3 = MyQuatern.Euler(valor * 1.5f, valor * 1.5f, 0);

            ejer3[1] = (miQuat3 * new Vec3(ejer3[1]));
            ejer3[3] = (MyQuatern.Inverse(miQuat3) * new Vec3(ejer3[3]));

            // ---------------

            Vector3Debugger.UpdatePositionsSecuence("tercero", ejer3);

            break;
        }
    }
예제 #2
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            DoNextExcercise();
        }

        switch (excersice)
        {
        case Excersice.FIRST:
            point1.rotation *= MyQuaternion.Euler(0, angle * Time.deltaTime * speed, 0);

            secuencePointList[1] = point1.forward * 10f;
            break;

        case Excersice.SECOND:
            point1.rotation *= MyQuaternion.Euler(0, angle * Time.deltaTime * speed, 0);

            secuencePointList[1] = point1.forward * 10f;
            secuencePointList[2] = secuencePointList[1] + (Vector3.up * 10f);
            secuencePointList[3] = secuencePointList[2] + (point1.forward * 10f);
            break;

        case Excersice.THIRD:
            point1.rotation *= Quaternion.Euler(0, angle * Time.deltaTime * speed, angle * Time.deltaTime * speed);
            point2.rotation *= Quaternion.Euler(0, -angle * Time.deltaTime * speed, -angle * Time.deltaTime * speed);

            secuencePointList[1] = point1.transform.forward * 10f;
            secuencePointList[2] = secuencePointList[1] + (point1.up * 10f);
            secuencePointList[3] = secuencePointList[2] + (point2.forward * 10f);
            secuencePointList[4] = secuencePointList[3] + (point2.up * 10f);
            break;
        }

        Vector3Debugger.UpdatePositionsSecuence("Secuence", secuencePointList);
    }