Пример #1
0
    void DrawStellarCurve(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3)
    {
        float   t   = 0f;
        Vector3 Pre = StellarInterface.Interp(p0, p1, p2, p3, 0);

        for (int i = 1; i <= DrawPieces; i++)
        {
            t = i / 60f;
            Vector3 Cur = StellarInterface.Interp(p0, p1, p2, p3, t);
            Handles.DrawLine(Pre, Cur);
            Pre = Cur;
        }
    }
Пример #2
0
        public Vector3 Velocity(float t)
        {
            int index = 0;

            if (t >= 1)
            {
                t     = 1;
                index = Points.Length - 4;
            }
            else
            {
                t     = t * (Points.Length - 1) / 3;
                index = (int)t;
                t     = t - index;
            }

            return(transform.TransformPoint(StellarInterface.Velocity(Points[index], Points[index + 1], Points[index + 2], Points[index + 3], t)) - transform.position);
        }