Class Spline
The Spline class is a collection of BezierKnot, the closed/open state, and editing representation.
Implements
Inherited Members
Namespace: UnityEngine.Splines
Assembly: solution.dll
Syntax
[Serializable]
public class Spline : ISpline, IReadOnlyList<BezierKnot>, IReadOnlyCollection<BezierKnot>, IList<BezierKnot>, ICollection<BezierKnot>, IEnumerable<BezierKnot>, IEnumerable
Constructors
Name | Description |
---|---|
Spline() | Default constructor creates a spline with no knots, not closed. |
Spline(IEnumerable<BezierKnot>, bool) | Create a spline from a collection of BezierKnot. |
Spline(int, bool) | Create a spline with a pre-allocated knot capacity. |
Spline(Spline) | Create a copy of a spline. |
Properties
Name | Description |
---|---|
Closed | Whether the spline is open (has a start and end point) or closed (forms an unbroken loop). |
Count | Return the number of knots. |
IsReadOnly | Returns true if this Spline is read-only, false if it is mutable. |
this[int] | Get or set the knot at |
Knots | A collection of BezierKnot. |
Methods
Name | Description |
---|---|
Add(BezierKnot) | Adds a knot to the spline. |
Add(BezierKnot, TangentMode) | Adds a knot to the spline. |
Add(BezierKnot, TangentMode, float) | Adds a knot to the spline. |
Clear() | Remove all knots from the spline. |
Contains(BezierKnot) | Return true if a knot is present in the spline. |
Copy(Spline) | Copy the values from |
CopyTo(BezierKnot[], int) | Copies the contents of the knot list to an array starting at an index. |
EnforceTangentModeNoNotify(int) | Ensure that a BezierKnot has the correct tangent and rotation values to match it's TangentMode and tension. This can be necessary if knot data is modified outside of the Spline class (ex, manually setting the Knots array without taking care to also set the tangent modes). |
EnforceTangentModeNoNotify(SplineRange) | Ensure that a BezierKnot has the correct tangent and rotation values to match it's TangentMode and tension. This can be necessary if knot data is modified outside of the Spline class (ex, manually setting the Knots array without taking care to also set the tangent modes). |
GetAutoSmoothTension(int) | Gets the tension value for the requested index. |
GetCurve(int) | Get a BezierCurve from a knot index. |
GetCurveInterpolation(int, float) | Return the normalized interpolation (t) corresponding to a distance on a BezierCurve. |
GetCurveLength(int) | Return the length of a curve. |
GetCurveUpVector(int, float) | Return the up vector for a t ratio on the curve. |
GetEnumerator() | Get an enumerator that iterates through the BezierKnot collection. |
GetFloat4DataKeys() | Get a collection of the keys of embedded SplineData<T> for this type. |
GetFloat4DataValues() | Get a collection of the SplineData<T> values for this type. |
GetFloatDataKeys() | Get a collection of the keys of embedded SplineData<T> for this type. |
GetFloatDataValues() | Get a collection of the SplineData<T> values for this type. |
GetIntDataKeys() | Get a collection of the keys of embedded SplineData<T> for this type. |
GetIntDataValues() | Get a collection of the SplineData<T> values for this type. |
GetLength() | Return the sum of all curve lengths, accounting for Closed state. Note that this value is not accounting for transform hierarchy. If you require length in world space use |
GetObjectDataKeys() | Get a collection of the keys of embedded SplineData<T> for this type. |
GetObjectDataValues() | Get a collection of the SplineData<T> values for this type. |
GetOrCreateFloat4Data(string) | Returns a SplineData<T> for |
GetOrCreateFloatData(string) | Returns a SplineData<T> for |
GetOrCreateIntData(string) | Returns a SplineData<T> for |
GetOrCreateObjectData(string) | Returns a SplineData<T> for |
GetSplineDataKeys(EmbeddedSplineDataType) | Get a collection of the keys of embedded SplineData<T> for this type. |
GetTangentMode(int) | Gets the TangentMode for a knot index. |
IndexOf(BezierKnot) | Return the first index of an element matching item. |
Insert(int, BezierKnot) | Insert a BezierKnot at the specified |
Insert(int, BezierKnot, TangentMode) | Inserts a BezierKnot at the specified |
Insert(int, BezierKnot, TangentMode, float) | Adds a BezierKnot at the specified |
OnSplineChanged() | Invoked any time a spline property is modified. |
Remove(BezierKnot) | Removes the first matching knot. |
RemoveAt(int) | Removes the knot at the specified index. |
RemoveFloat4Data(string) | Remove a SplineData<T> value. |
RemoveFloatData(string) | Remove a SplineData<T> value. |
RemoveIntData(string) | Remove a SplineData<T> value. |
RemoveObjectData(string) | Remove a SplineData<T> value. |
Resize(int) | Change the size of the BezierKnot list. |
SetAutoSmoothTension(int, float) | Sets the tension that is used to calculate the magnitude of tangents when the TangentMode is AutoSmooth. Valid values are between 0 and 1. A lower value results in sharper curves, whereas higher values appear more rounded. |
SetAutoSmoothTension(SplineRange, float) | Sets the tension that is used to calculate the magnitude of tangents when the TangentMode is AutoSmooth. Valid values are between 0 and 1. A lower value results in sharper curves, whereas higher values appear more rounded. |
SetAutoSmoothTensionNoNotify(int, float) | Sets the tension that is used to calculate the magnitude of tangents when the TangentMode is AutoSmooth. Valid values are between 0 and 1. A lower value results in sharper curves, whereas higher values appear more rounded. No changed callbacks will be invoked. |
SetAutoSmoothTensionNoNotify(SplineRange, float) | Set the tension that is used to calculate the magnitude of tangents when the TangentMode is AutoSmooth. Valid values are between 0 and 1. A lower value results in sharper curves, whereas higher values appear more rounded. No changed callbacks will be invoked. |
SetFloat4Data(string, SplineData<float4>) | Set the SplineData<T> for . |
SetFloatData(string, SplineData<float>) | Set the SplineData<T> for . |
SetIntData(string, SplineData<int>) | Set the SplineData<T> for . |
SetKnot(int, BezierKnot, BezierTangent) | Sets the value of a knot at index. |
SetKnotNoNotify(int, BezierKnot, BezierTangent) | Sets the value of a knot index without invoking any change callbacks. |
SetObjectData(string, SplineData<Object>) | Set the SplineData<T> for . |
SetTangentMode(int, TangentMode, BezierTangent) | Sets the TangentMode for a knot, and ensures that the rotation and tangent values match the behavior of the tangent mode. This function can modify the contents of the BezierKnot at the specified index. |
SetTangentMode(SplineRange, TangentMode, BezierTangent) | Sets the TangentMode for a series of knots, and ensures that the rotation and tangent values match the behavior of the tangent mode. This function can modify the contents of the BezierKnot at the specified indices. |
SetTangentMode(TangentMode) | Sets the TangentMode for all knots on this spline. |
SetTangentModeNoNotify(int, TangentMode, BezierTangent) | Sets the TangentMode for a knot, and ensures that the rotation and tangent values match the behavior of the tangent mode. No changed callbacks will be invoked. This function can modify the contents of the BezierKnot at the specified index. |
ToArray() | Create an array of spline knots. |
TryGetFloat4Data(string, out SplineData<float4>) | Retrieve a SplineData<T> reference for if it exists. Note that this is a reference to the stored SplineData<T>, not a copy. Any modifications to this collection will affect the Spline data. |
TryGetFloatData(string, out SplineData<float>) | Retrieve a SplineData<T> reference for if it exists. Note that this is a reference to the stored SplineData<T>, not a copy. Any modifications to this collection will affect the Spline data. |
TryGetIntData(string, out SplineData<int>) | Retrieve a SplineData<T> reference for if it exists. Note that this is a reference to the stored SplineData<T>, not a copy. Any modifications to this collection will affect the Spline data. |
TryGetObjectData(string, out SplineData<Object>) | Retrieve a SplineData<T> reference for if it exists. Note that this is a reference to the stored SplineData<T>, not a copy. Any modifications to this collection will affect the Spline data. |
Warmup() | Ensure that all caches contain valid data. Call this to avoid unexpected performance costs when accessing spline data. Caches remain valid until any part of the spline state is modified. |
Events
Name | Description |
---|---|
Changed | Invoked any time a spline is modified. |