Class SplineContainer
A Component that holds a Spline object.
Namespace: UnityEngine.Splines
Syntax
public sealed class SplineContainer : MonoBehaviour, ISplineProvider
Properties
Spline
The instantiated Spline object attached to this component.
Declaration
public Spline Spline { get; set; }
Property Value
Type | Description |
---|---|
Spline |
Methods
CalculateLength()
Calculate the length of Spline in world space.
Declaration
public float CalculateLength()
Returns
Type | Description |
---|---|
Single | The length of Spline in world space |
Evaluate(Single, out float3, out float3, out float3)
Compute interpolated position, direction and upDirection at ratio t. Calling this method to get the 3 vectors is faster than calling independently EvaluateSplinePosition, EvaluateSplineTangent and EvaluateSplineUpVector for the same time t as it reduces some redundant computation.
Declaration
public bool Evaluate(float t, out float3 position, out float3 tangent, out float3 upVector)
Parameters
Type | Name | Description |
---|---|---|
Single | t | A value between 0 and 1 representing the ratio along the curve. |
float3 | position | Output variable for the float3 position at t. |
float3 | tangent | Output variable for the float3 tangent at t. |
float3 | upVector | Output variable for the float3 up direction at t. |
Returns
Type | Description |
---|---|
Boolean | Boolean value, true if a valid set of output variables as been computed. |
EvaluateAcceleration(Single)
Evaluate an acceleration vector at a specific t
Declaration
public float3 EvaluateAcceleration(float t)
Parameters
Type | Name | Description |
---|---|---|
Single | t | A value between 0 and 1 representing a percentage of entire spline |
Returns
Type | Description |
---|---|
float3 | An acceleration vector. |
EvaluatePosition(Single)
Evaluate a tangent vector on a curve at a specific t in world space.
Declaration
public float3 EvaluatePosition(float t)
Parameters
Type | Name | Description |
---|---|---|
Single | t | A value between 0 and 1 representing a percentage of the curve. |
Returns
Type | Description |
---|---|
float3 | A tangent vector. |
EvaluateTangent(Single)
Evaluate a tangent vector at a specific t in world space.
Declaration
public float3 EvaluateTangent(float t)
Parameters
Type | Name | Description |
---|---|---|
Single | t | A value between 0 and 1 representing a percentage of entire spline |
Returns
Type | Description |
---|---|
float3 | A tangent vector |
EvaluateUpVector(Single)
Evaluate an up vector direction at a specific t
Declaration
public float3 EvaluateUpVector(float t)
Parameters
Type | Name | Description |
---|---|---|
Single | t | A value between 0 and 1 representing a percentage of entire spline |
Returns
Type | Description |
---|---|
float3 | An up direction. |
Explicit Interface Implementations
ISplineProvider.Splines
Declaration
IEnumerable<Spline> ISplineProvider.Splines { get; }
Returns
Type | Description |
---|---|
IEnumerable<Spline> |