Exemplo n.º 1
0
    void Update()
    {
        Vector2 offsetTarget = target.GetVelocity() * offsetMult;
        Vector2 offsetDist   = offsetTarget - offset;

        if (offsetDist.magnitude > offsetStepSize)
        {
            offsetDist.Normalize();
            offsetDist *= offsetStepSize;
        }
        offset += offsetDist;
        if (target != null)
        {
            rt.anchoredPosition = trt.anchoredPosition + offset;
        }
    }