Beispiel #1
0
    void DrawRopeWaves()
    {
        for (int i = 0; i < precision; i++)
        {
            float   delta           = (float)i / ((float)precision - 1f);
            Vector2 offset          = Vector2.Perpendicular(grapple.GetGrapplingDistance()).normalized *ropeAnimationCurve.Evaluate(delta) * waveSize;
            Vector2 targetPosition  = Vector2.Lerp(grapple.GetFirePoint(), grapple.GetGrapplePoint(), delta) + offset;
            Vector2 currentPosition = Vector2.Lerp(grapple.GetFirePoint(), targetPosition, ropeProgressionCurve.Evaluate(moveTime) * ropeProgressionSpeed);

            lineRenderer.SetPosition(i, currentPosition);
        }
    }