Interface ISpline
ISpline defines the interface from which Spline types inherit.
Inherited Members
Namespace: UnityEngine.Splines
Syntax
public interface ISpline : IReadOnlyList<BezierKnot>, IReadOnlyCollection<BezierKnot>, IEnumerable<BezierKnot>, IEnumerable
Properties
Closed
Whether the spline is open (has a start and end point) or closed (forms an unbroken loop).
Declaration
bool Closed { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
GetCurve(Int32)
Get a BezierCurve from a knot index.
Declaration
BezierCurve GetCurve(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The knot index that serves as the first control point for this curve. |
Returns
Type | Description |
---|---|
BezierCurve | A BezierCurve formed by the knot at index and the next knot. |
GetCurveInterpolation(Int32, Single)
Return the interpolation ratio (0 to 1) corresponding to a distance on a BezierCurve. Distance is relative to the curve.
Declaration
float GetCurveInterpolation(int curveIndex, float curveDistance)
Parameters
Type | Name | Description |
---|---|---|
Int32 | curveIndex | The zero-based index of the curve. |
Single | curveDistance | The distance (measuring from the knot at curveIndex) to convert to a normalized interpolation ratio. |
Returns
Type | Description |
---|---|
Single | The normalized interpolation ratio matching distance on the designated curve. |
GetCurveLength(Int32)
Return the length of a curve.
Declaration
float GetCurveLength(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the curve for which the length needs to be retrieved. |
Returns
Type | Description |
---|---|
Single | Returns the length of the curve of index 'index' in the spline. |
See Also
GetCurveUpVector(Int32, Single)
Return the up vector for a t ratio on the curve. Contrary to EvaluateUpVector<T>(T, Single), this method is trying to used cached values when possible for better performance when accessing to these values regularly.
Declaration
float3 GetCurveUpVector(int index, float t)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the curve for which the length needs to be retrieved. |
Single | t | A value between 0 and 1 representing the ratio along the curve. |
Returns
Type | Description |
---|---|
float3 | Returns the up vector at the t ratio of the curve of index 'index'. |
GetLength()
Return the sum of all curve lengths, accounting for Closed state.
Declaration
float GetLength()
Returns
Type | Description |
---|---|
Single | Returns the sum length of all curves composing this spline, accounting for closed state. |