public 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; // [0, 1]
i *= 3;
}
return transform.TransformPoint(
CatmullRom.GetFirstDerivative (points[i], points[i+1], points[i+2], points[i+3], t)
);
}