Class SplineFactory
Methods to create spline shapes.
Inherited Members
Namespace: UnityEngine.Splines
Assembly: Unity.Splines.dll
Syntax
public static class SplineFactory
Methods
CreateCatmullRom(IList<float3>, bool)
Create a Spline from a list of positions and place tangents to create Catmull Rom curves.
Declaration
public static Spline CreateCatmullRom(IList<float3> positions, bool closed = false)
Parameters
Type | Name | Description |
---|---|---|
IList<float3> | positions | A collection of knot positions. |
bool | closed | Whether the spline is open (has a start and end point) or closed (forms an unbroken loop). |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
CreateCircle(float)
Creates a Spline in the shape of a circle.
Declaration
public static Spline CreateCircle(float radius)
Parameters
Type | Name | Description |
---|---|---|
float | radius | The radius of the circle. |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
CreateHelix(float, float, int)
Creates a Spline in the shape of a helix with a single revolution.
Declaration
public static Spline CreateHelix(float radius, float height, int revolutions)
Parameters
Type | Name | Description |
---|---|---|
float | radius | The distance from the center to the helix's curve. |
float | height | The height of the helix shape. |
int | revolutions | The number of revolutions the helix should have. |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
CreateLinear(IList<float3>, bool)
Create a Spline from a list of positions.
Declaration
public static Spline CreateLinear(IList<float3> positions, bool closed = false)
Parameters
Type | Name | Description |
---|---|---|
IList<float3> | positions | A collection of knot positions. |
bool | closed | Whether the spline is open (has a start and end point) or closed (forms an unbroken loop). |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
CreateLinear(IList<float3>, IList<quaternion>, bool)
Create a Spline from a list of positions.
Declaration
public static Spline CreateLinear(IList<float3> positions, IList<quaternion> rotations, bool closed = false)
Parameters
Type | Name | Description |
---|---|---|
IList<float3> | positions | A collection of knot positions. |
IList<quaternion> | rotations | A collection of knot rotations. Must be equal in length to the positions array. |
bool | closed | Whether the spline is open (has a start and end point) or closed (forms an unbroken loop). |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
CreatePolygon(float, int)
Creates a Spline in the shape of a polygon with a specific number of sides.
Declaration
public static Spline CreatePolygon(float edgeSize, int sides)
Parameters
Type | Name | Description |
---|---|---|
float | edgeSize | The size of the polygon's edges. |
int | sides | The amount of sides the polygon has. |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
CreateRoundedCornerSquare(float, float)
Creates a Spline in the shape of a square with circular arcs at its corners.
Declaration
public static Spline CreateRoundedCornerSquare(float size, float cornerRadius)
Parameters
Type | Name | Description |
---|---|---|
float | size | The size of the square's edges. |
float | cornerRadius | The radius of the circular arcs at the corners of the shape.
A value of 0 creates a square with no rounding. A value that is half of |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
Remarks
The range for cornerRadius
is 0 and half of size
.
CreateRoundedSquare(float, float)
Create a Spline in a square shape with rounding at the edges.
Declaration
public static Spline CreateRoundedSquare(float radius, float rounding)
Parameters
Type | Name | Description |
---|---|---|
float | radius | The distance from center to outermost edge. |
float | rounding | The amount of rounding to apply to corners. |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
CreateSquare(float)
Creates a Spline in the shape of a square with sharp corners.
Declaration
public static Spline CreateSquare(float size)
Parameters
Type | Name | Description |
---|---|---|
float | size | The size of the square's edges. |
Returns
Type | Description |
---|---|
Spline | A new Spline. |
CreateStarPolygon(float, int, float)
Creates a Spline in in the shape of a star with a specified number of corners.
Declaration
public static Spline CreateStarPolygon(float edgeSize, int corners, float concavity)
Parameters
Type | Name | Description |
---|---|---|
float | edgeSize | The distance between the corners of the star. |
int | corners | The amount of corners the star has. |
float | concavity | The sharpness of the corners. The range is 0 through 1. |
Returns
Type | Description |
---|---|
Spline | A new Spline. |