Exemplo n.º 1
0
    void UpdateMovement()
    {
        if (Time.timeScale != 0f)
        {
            angle = TouchInput.GetAxis("Angle");
        }

        //angle += angularVelocity * TouchInput.GetAxis("RadialTouchShift") * Time.deltaTime;
        //if (angle > 2f * Mathf.PI) angle = 0f;
        //if (angle < 0f) angle = 2f * Mathf.PI;
        flyingRadius = Mathf.MoveTowards(flyingRadius, targetflyingRadius, Time.deltaTime * angularVelocityMax);
        Vector3 newPosition = new Vector3(flyingRadius * Mathf.Cos(angle), flyingRadius * Mathf.Sin(angle), transform.position.z);

        transform.position = newPosition;

        Vector3 newForwardPos = transform.position + (Vector3.forward * forwardVelocity * Time.deltaTime);

        transform.position = Vector3.Lerp(transform.position, newForwardPos, 50f);

        transform.LookAt(new Vector3(0f, 0f, transform.position.z));
        playerPositionZ = transform.position.z;
    }