Exemplo n.º 1
0
    public void RotateToVelocity()
    {
        Vector2 dir   = Jet.GetComponent <Rigidbody2D>().velocity;
        float   angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;

        Jet.transform.localRotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }
Exemplo n.º 2
0
    public void EaseVelocityTo()
    {
        t += Time.deltaTime;

        if (t >= 1 || Jet == null)
        {
            GameplayManager.OnUpdateDuringGame -= EaseVelocityTo;
        }
        else
        {
            Rigidbody2D rigidbody = Jet.GetComponent <Rigidbody2D>();
            rigidbody.AddForce(Vector2.Lerp(finalVelocity / 10, finalVelocity, t));
        }
    }