Class SplineJobs
The SplineJobs class contains utility methods for evaluating spline data using the Jobs system.
Inherited Members
Namespace: UnityEngine.Splines
Syntax
public static class SplineJobs
Methods
EvaluatePosition(NativeSpline, NativeArray<float3>)
Populate a preallocated NativeArray with position data from a spline.
Declaration
public static void EvaluatePosition(NativeSpline spline, NativeArray<float3> positions)
Parameters
Type | Name | Description |
---|---|---|
NativeSpline | spline | The spline to evaluate. The NativeSpline must be allocated with a Persistent or TempJob allocator. Temp is invalid for use in the Jobs system. |
NativeArray<float3> | positions | A preallocated array of float3 to be populated with evenly interpolated positions from a spline. |
EvaluatePosition<T>(T, NativeArray<float3>)
Populate a preallocated NativeArray with position data from a spline.
Declaration
public static void EvaluatePosition<T>(T spline, NativeArray<float3> positions)
where T : ISpline
Parameters
Type | Name | Description |
---|---|---|
T | spline | The spline to evaluate. If you pass a NativeSpline, it must be allocated with the Persistent or TempJob allocator. Temp is invalid for use with the Jobs system. |
NativeArray<float3> | positions | A preallocated array of float3 to be populated with evenly interpolated positions from a spline. |
Type Parameters
Name | Description |
---|---|
T | The type of ISpline. |
EvaluatePositionTangentNormal(NativeSpline, NativeArray<float3>, NativeArray<float3>, NativeArray<float3>)
Populate a set of preallocated NativeArray with position, tangent, and normal data from a spline.
Declaration
public static void EvaluatePositionTangentNormal(NativeSpline spline, NativeArray<float3> positions, NativeArray<float3> tangents, NativeArray<float3> normals)
Parameters
Type | Name | Description |
---|---|---|
NativeSpline | spline | The spline to evaluate. The NativeSpline must be allocated with a Persistent or TempJob allocator. Temp is invalid for use in the Jobs system. |
NativeArray<float3> | positions | A preallocated array of float3 to be populated with evenly interpolated positions from a spline. |
NativeArray<float3> | tangents | A preallocated array of float3 to be populated with evenly interpolated tangents from a spline. Must be the same size as the positions array. |
NativeArray<float3> | normals | A preallocated array of float3 to be populated with evenly interpolated normals from a spline. Must be the same size as the positions array. |
Remarks
To apply a transform to the results of this method, pass a new NativeSpline constructed with the desired transformation matrix.
EvaluatePositionTangentNormal<T>(T, NativeArray<float3>, NativeArray<float3>, NativeArray<float3>)
Populate a set of pre-allocated NativeArray with position, tangent, and normal data from a spline.
Declaration
public static void EvaluatePositionTangentNormal<T>(T spline, NativeArray<float3> positions, NativeArray<float3> tangents, NativeArray<float3> normals)
where T : ISpline
Parameters
Type | Name | Description |
---|---|---|
T | spline | The spline to evaluate. If you pass a NativeSpline, it must be allocated with the Persistent or TempJob allocator. Temp is invalid for use with the Jobs system. |
NativeArray<float3> | positions | A preallocated array of float3 to be populated with evenly interpolated positions from a spline. |
NativeArray<float3> | tangents | A preallocated array of float3 to be populated with evenly interpolated tangents from a spline. Must be the same size as the positions array. |
NativeArray<float3> | normals | A preallocated array of float3 to be populated with evenly interpolated normals from a spline. Must be the same size as the positions array. |
Type Parameters
Name | Description |
---|---|
T | The type of ISpline. |
Remarks
To apply a transform to the results of this method, pass a new NativeSpline constructed with the desired transformation matrix.
This method creates a temporary NativeSpline copy of the spline to be evaluated. In some cases, this can be more resource intensive than iterating and evaluating a spline on a single thread. For the best performance, pass an existing NativeSpline instance to the parameter.