void ShowDirection() { Vector3 point; Handles.color = Color.green; for (int i = 0; i < curve.PointNum * m_nLineSteps; i++) { point = curve.GetPoint(i / (float)(curve.PointNum * m_nLineSteps)); Handles.DrawLine(point, point + curve.GetDirection(i / (float)(curve.PointNum * m_nLineSteps)) * m_fScaleDir); } }
//根据进度获取点 public Vector3 GetPoint(float t) { int i; if (t >= 1.0f) { t = 1.0f; i = PointNum - 4; } else { t *= CurveNum; i = (int)t; t = t - i; i *= 3; } return(transform.TransformPoint(TestBezierLineForStu.GetPoint(m_vPoints[i], m_vPoints[i + 1], m_vPoints[i + 2], m_vPoints[i + 3], t))); }