Exemplo n.º 1
0
        public Vector3 GetPoint(float t)
        {
            var sections = linearPoints.Length - (spline.closed ? 0 : 3);
            var i        = Mathf.Min(Mathf.FloorToInt(t * (float)sections), sections - 1);
            var count    = linearPoints.Length;

            if (i < 0)
            {
                i += count;
            }
            var u = t * (float)sections - (float)i;
            var a = linearPoints[(i + 0) % count];
            var b = linearPoints[(i + 1) % count];
            var c = linearPoints[(i + 2) % count];
            var d = linearPoints[(i + 3) % count];

            return(SplineComponent.Interpolate(a, b, c, d, u));
        }
Exemplo n.º 2
0
 public SplineIndex(SplineComponent spline)
 {
     this.spline = spline;
     ReIndex();
 }