Assets/SplineTool/Scripts/CorgiSpline/Spline.cs
/// <summary>
/// Returns the lower index of the pair surrounding wherever t ends up on the spline. Returns -1 if no points exist. t is valid from 0 to 1.
/// </summary>
/// <param name="t"></param>
/// <returns></returns>
Returns the lower index of the pair surrounding wherever t ends up on the spline. Returns -1 if no points exist. t is valid from 0 to 1.
Returns the lower index of the pair surrounding wherever t ends up on the spline . Returns - 1 if no points exist . t is valid from 0 to 1 .
public int GetPointIndexFromTime(float t)
        {
            if (Points.Length == 0)
            {
                return -1;
            }
            t = Mathf.Clamp01(t);
            if (Mode == SplineMode.Linear)
            {
                return Mathf.FloorToInt(t * Points.Length);
            }
            else if (Mode == SplineMode.Bezier)
            {
                var index_estimate = Mathf.FloorToInt(t * Points.Length);
                return index_estimate - index_estimate % 3;
            }
            else if (Mode == SplineMode.BSpline)
            {
                return Mathf.FloorToInt(t * Points.Length);
            }
            else
            {
                return -1;
            }
        }
public int GetPointIndexFromTime ( float t ) { if ( Points . Length == 0 ) { return - 1 ; } t = Mathf . Clamp01 ( t ) ; if ( Mode == SplineMode . Linear ) { return Mathf . FloorToInt ( t * Points . Length ) ; } else if ( Mode == SplineMode . Bezier ) { var index_estimate = Mathf . FloorToInt ( t * Points . Length ) ; return index_estimate - index_estimate % 3 ; } else if ( Mode == SplineMode . BSpline ) { return Mathf . FloorToInt ( t * Points . Length ) ; } else { return - 1 ; } }
Returns the lower index of the pair surrounding wherever t ends up on the spline.
Returns the lower index of the pair surrounding wherever t ends up on the spline .
// not implemented 
None
t
float
None