Class SplineShape
Create a shape using a Spline as the template path. The referenced Spline is sampled at SideCount points along the path to form the vertex rings at each segment.
Implements
Inherited Members
Namespace: UnityEngine.Splines.ExtrusionShapes
Assembly: Unity.Splines.dll
Syntax
[Serializable]
public class SplineShape : IExtrudeShape
Fields
m_Axis
Defines the axes used to project the input spline template to 2D coordinates.
Declaration
[SerializeField]
[Tooltip("The axis of the template spline to be used when winding the vertices along the extruded mesh.")]
public SplineShape.Axis m_Axis
Field Value
Type | Description |
---|---|
SplineShape.Axis |
Properties
SideCount
How many vertices make up a single ring around the mesh.
Declaration
public int SideCount { get; set; }
Property Value
Type | Description |
---|---|
int | How many vertices make up a revolution for each segment of the extruded mesh. |
Spline
Returns the Spline referenced by the SplineContainer and SplineIndex.
Declaration
public Spline Spline { get; }
Property Value
Type | Description |
---|---|
Spline |
SplineContainer
The SplineContainer which contains the Spline to use as the shape template.
Declaration
public SplineContainer SplineContainer { get; set; }
Property Value
Type | Description |
---|---|
SplineContainer |
SplineIndex
The index of the Spline in the SplineContainer to use as the shape template. This value must be greater than or equal to 0. If the index is out of bounds of the container spline count, the modulo of SplineIndex and Container.Splines.Count is used as the index.
Declaration
public int SplineIndex { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
GetPosition(float, int)
This method is responsible for returning a 2D position of the template shape for each vertex of a single
ring around the extruded mesh.
Note that both interpolation t
and index
are provided as a convenience.
Declaration
public float2 GetPosition(float t, int index)
Parameters
Type | Name | Description |
---|---|---|
float | t | The normalized interpolation [0...1] for a vertex around an extruded ring. |
int | index | The index of the vertex in the extruded ring. |
Returns
Type | Description |
---|---|
float2 | A 2D position interpolated along a template shape to be extruded. This value will be converted to a 3D point and rotated to align with the spline at the current segment index. |