Beispiel #1
0
    void LookAtPlanet(float speed)
    {
        if (OnFloor())
        {
            speed = speed * 4;
        }
        Vector2 globaRotation = Mathf.Polar2Cartesian(1, GetGlobalRotation());
        Vector2 lerpRotation  = new Vector2(Mathf.Lerp(globaRotation.x, right.x, speed),
                                            Mathf.Lerp(globaRotation.y, right.y, speed));

        SetRotation(Mathf.Cartesian2Polar(lerpRotation.x, lerpRotation.y).y);
    }