Unity 贝塞尔曲线

https://en.wikipedia.org/wiki/B%C3%A9zier_curve
http://docs.unity3d.com/ScriptReference/Handles.DrawBezier.html

Unity 贝塞尔曲线_第1张图片
Paste_Image.png
    public static Vector3 CalculateBezierPoint(Vector3 p0 /*startPosition*/, Vector3 p1/*startTangent*/, Vector3 p2/*endTangent*/, Vector3 p3/*endPosition*/, float t)
    {
        float t2 = t * t;
        float t3 = t2 * t;
        float u = 1.0f - t;
        float u2 = u * u;
        float u3 = u2 * u;

        return u3 * p0 + 3 * u2 * t * p1 + 3 * u * t2 * p2 + t3 * p3;
    }

你可能感兴趣的:(Unity 贝塞尔曲线)