/// <inheritdoc /> protected override Vector3 GetPointInternal(float normalizedDistance) { var totalDistance = normalizedDistance * (PointCount - 1); int point1Index = Mathf.FloorToInt(totalDistance); point1Index -= point1Index % 3; float subDistance = (totalDistance - point1Index) / 3; int point2Index; int point3Index; int point4Index; if (!Loops) { if (point1Index + 3 >= PointCount) { return(controlPoints[PointCount - 1].Position); } if (point1Index < 0) { return(controlPoints[0].Position); } point2Index = point1Index + 1; point3Index = point1Index + 2; point4Index = point1Index + 3; } else { point2Index = (point1Index + 1) % (PointCount - 1); point3Index = (point1Index + 2) % (PointCount - 1); point4Index = (point1Index + 3) % (PointCount - 1); } Vector3 point1 = controlPoints[point1Index].Position; Vector3 point2 = controlPoints[point2Index].Position; Vector3 point3 = controlPoints[point3Index].Position; Vector3 point4 = controlPoints[point4Index].Position; return(LineUtility.InterpolateBezierPoints(point1, point2, point3, point4, subDistance)); }
protected override Vector3 GetPointInternal(float normalizedDistance) { return(LineUtility.InterpolateBezierPoints(controlPoints.Point1, controlPoints.Point2, controlPoints.Point3, controlPoints.Point4, normalizedDistance)); }