public override Vector3 GetVelocity(float t) { int i; if (t >= 1f) { t = 1f; i = Points.Length - 4; } else { t = Mathf.Clamp01(t) * CurveCount; i = (int)t; t -= i; i *= 3; } return(transform.TransformPoint(BezierUtils.GetFirstDerivative(Points[i], Points[i + 1], Points[i + 2], Points[i + 3], t)) - transform.position); }
public override Vector3 GetPoint(float t) { if (Points.Length < 4) { return(Vector3.zero); } int i; if (t >= 1f) { t = 1f; i = Points.Length - 4; } else { t = Mathf.Clamp01(t) * CurveCount; i = (int)t; t -= i; i *= 3; } return(transform.TransformPoint(BezierUtils.GetPoint(Points[i], Points[i + 1], Points[i + 2], Points[i + 3], t))); }