Table of Contents

Class CurvySpline

Curvy Spline class

[AddComponentMenu("Curvy/Curvy Spline")]
[ExecuteAlways]
public class CurvySpline : DTVersionedMonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
DTVersionedMonoBehaviour
CurvySpline
Derived
Extension Methods

Constructors

CurvySpline()

public CurvySpline()

Fields

ShowGizmos

Whether to show the Gizmos enabled in the view settings or not at all

[HideInInspector]
public bool ShowGizmos

Field Value

bool

Properties

AutoEndTangents

Whether the first/last Control Point should act as the end tangent, too.

public bool AutoEndTangents { get; set; }

Property Value

bool

Remarks

Ignored by linear splines and Bezier ones

AutoHandleDistance

Gets or sets the default Handle distance for Bezier splines

public float AutoHandleDistance { get; set; }

Property Value

float

BSplineDegree

Used only when Interpolation is BSpline The degree of the piecewise polynomial functions Is in the range [2; control points count - 1]

public int BSplineDegree { get; set; }

Property Value

int

Bias

Global Bias

public float Bias { get; set; }

Property Value

float

Remarks

This only applies to TCB interpolation

Bounds

The bounding box of the spline, in world space

public Bounds Bounds { get; }

Property Value

Bounds

CacheDensity

Gets or sets the cache density Defines how densely the cached points are. When the value is 100, the number of cached points per world distance unit is equal to the spline's MaxPointsPerUnit

public int CacheDensity { get; set; }

Property Value

int

CacheSize

Gets total Cache Size

public int CacheSize { get; }

Property Value

int

CheckTransform

Whether the spline should automatically refresh when a Control Point's position change

public bool CheckTransform { get; set; }

Property Value

bool

Remarks

Enable this if you animate a Control Point's transform!

Closed

Whether this spline is closed or not

public bool Closed { get; set; }

Property Value

bool

Remarks

AutoEndTangents's value can be updated depending on Close value

Continuity

Global Continuity

public float Continuity { get; set; }

Property Value

float

Remarks

This only applies to TCB interpolation

ControlPointCount

Gets the number of Control Points

public int ControlPointCount { get; }

Property Value

int

ControlPointsList

The list of control points

public ReadOnlyCollection<CurvySplineSegment> ControlPointsList { get; }

Property Value

ReadOnlyCollection<CurvySplineSegment>

Count

Gets the number of Segments

public int Count { get; }

Property Value

int

Dirty

When a spline is dirty, this means that it's cached data is no more up to date, and should be updated. The update is done automatically each frame when needed, or manually by calling Refresh()

public bool Dirty { get; }

Property Value

bool

FirstSegment

Gets the first segment of the spline

[CanBeNull]
public CurvySplineSegment FirstSegment { get; }

Property Value

CurvySplineSegment

FirstVisibleControlPoint

Gets the first visible Control Point (equals the first segment or this[0])

[CanBeNull]
public CurvySplineSegment FirstVisibleControlPoint { get; }

Property Value

CurvySplineSegment

Remarks

Can be null, for example for a Catmull-Rom spline whith only two splines and AutoEndTangent set to false

GizmoColor

Gets or sets Spline color

public Color GizmoColor { get; set; }

Property Value

Color

GizmoSelectionColor

Gets or sets selected segment color

public Color GizmoSelectionColor { get; set; }

Property Value

Color

GlobalCoordinatesChangedThisFrame

Returns true if the global position, rotation or scale of the spline has changed this frame

public bool GlobalCoordinatesChangedThisFrame { get; }

Property Value

bool
See Also

Interpolation

The interpolation method used by this spline

public CurvyInterpolation Interpolation { get; set; }

Property Value

CurvyInterpolation

Remarks

AutoEndTangents's value can be updated depending on Interpolation value

IsBSplineClamped

Used only when Interpolation is BSpline Make the curve pass through the first and last control points by increasing the multiplicity of the first and last knots. In technical terms, when this parameter is true, the knot vector is [0, 0, ...,0, 1, 2, ..., N-1, N, N, ..., N]. When false, it is [0, 1, 2, ..., N-1, N]

public bool IsBSplineClamped { get; set; }

Property Value

bool

IsInitialized

Whether the spline is fully initialized and all segments loaded

public bool IsInitialized { get; }

Property Value

bool

this[int]

Gets the Segment at a certain index

public CurvySplineSegment this[int idx] { get; }

Parameters

idx int

an index in the range 0..Count

Property Value

CurvySplineSegment

the corresponding spline segment

LastSegment

Gets the last segment of the spline

[CanBeNull]
public CurvySplineSegment LastSegment { get; }

Property Value

CurvySplineSegment

LastVisibleControlPoint

Gets the last visible Control Point (i.e. the end CP of the last segment)

[CanBeNull]
public CurvySplineSegment LastVisibleControlPoint { get; }

Property Value

CurvySplineSegment

Remarks

Is null if spline has no segments

Length

Gets the total length of the Spline

public float Length { get; }

Property Value

float

Remarks

The accuracy depends on the current Granularity (higher Granularity means more exact values)

MaxPointsPerUnit

The maximum number of sampling points per world distance unit. Sampling is used in caching or shape extrusion for example

public float MaxPointsPerUnit { get; set; }

Property Value

float

OnAfterControlPointAdd

Callback after a Control Point has been added and the spline was refreshed

public CurvyControlPointEvent OnAfterControlPointAdd { get; set; }

Property Value

CurvyControlPointEvent

OnAfterControlPointChanges

Callback after one or more Control Points have been added or deleted

public CurvySplineEvent OnAfterControlPointChanges { get; set; }

Property Value

CurvySplineEvent

Remarks

This executes last, after individual add/delete events and OnRefresh

OnBeforeControlPointAdd

Callback before a Control Point is about to be added

public CurvyControlPointEvent OnBeforeControlPointAdd { get; set; }

Property Value

CurvyControlPointEvent

OnBeforeControlPointDelete

Callback before a Control Point is about to be deleted. Return false to cancel the execution.

public CurvyControlPointEvent OnBeforeControlPointDelete { get; set; }

Property Value

CurvyControlPointEvent

OnGlobalCoordinatesChanged

Is triggered when the global position, rotation or scale of the spline changes. The triggering instance of CurvySpline is passed as a parameter of the delegate

[CanBeNull]
public Action<CurvySpline> OnGlobalCoordinatesChanged { get; set; }

Property Value

Action<CurvySpline>

Remarks

This is triggered at the very end of the spline updating method. UpdateIn

See Also

OnInitialized

Event triggered when the spline is initialized

public CurvySplineEvent OnInitialized { get; set; }

Property Value

CurvySplineEvent

OnRefresh

Event triggered when the spline is updated, including its initial update

public CurvySplineEvent OnRefresh { get; set; }

Property Value

CurvySplineEvent

Orientation

Orientation mode

public CurvyOrientation Orientation { get; set; }

Property Value

CurvyOrientation

RestrictTo2D

Whether to restrict Control Points to a local 2D plane

public bool RestrictTo2D { get; set; }

Property Value

bool
See Also

Restricted2DPlane

The local 2D plane to restrict the spline's control point in

public CurvyPlane Restricted2DPlane { get; set; }

Property Value

CurvyPlane
See Also

Tension

Global Tension

public float Tension { get; set; }

Property Value

float

Remarks

This only applies to TCB interpolation

UpdateIn

public CurvyUpdateMethod UpdateIn { get; set; }

Property Value

CurvyUpdateMethod

UsePooling

Whether to use GameObject pooling for Control Points at runtime

public bool UsePooling { get; set; }

Property Value

bool

UseThreading

Whether to use threading where applicable or not. Threading is currently not supported when targeting WebGL and Universal Windows Platform

public bool UseThreading { get; set; }

Property Value

bool

Methods

Add()

Adds a Control Point at the end of the spline This method will Refresh() the spline and call the relevant events. If you want more control on the order of the added Control Point, its position, or whether Refresh() and events should be called, use the InsertBefore(CurvySplineSegment, Vector3, bool, Space) and InsertAfter(CurvySplineSegment, Vector3, bool, Space) and Add(Vector3, Space) instead

public CurvySplineSegment Add()

Returns

CurvySplineSegment

The added Control Point

Add(int)

Adds several Control Points at the end of the spline This method will Refresh() the spline and call the relevant events. If you want more control on the order of the added Control Points, their position, or whether Refresh() and events should be called, use the InsertBefore(CurvySplineSegment, Vector3, bool, Space) and InsertAfter(CurvySplineSegment, Vector3, bool, Space) and Add(Vector3[], Space) instead

public CurvySplineSegment[] Add(int controlPointsCount)

Parameters

controlPointsCount int

The number of Control Points to add

Returns

CurvySplineSegment[]

Add(Vector3, Space)

Adds several Control Points at the end of the spline This method will Refresh() the spline and call the relevant events. If you want more control on the order of the added Control Points, their position, or whether Refresh() and events should be called, use the InsertBefore(CurvySplineSegment, Vector3, bool, Space) and InsertAfter(CurvySplineSegment, Vector3, bool, Space) instead

public CurvySplineSegment Add(Vector3 controlPointPosition, Space space)

Parameters

controlPointPosition Vector3

The position of the Control Point to add

space Space

Whether the position is in the local or global space

Returns

CurvySplineSegment

The added Control Points

Add(params Vector3[])

Adds several Control Points at the end of the spline This method will Refresh() the spline and call the relevant events. If you want more control on the order of the added Control Points, their position, or whether Refresh() and events should be called, use the InsertBefore(CurvySplineSegment, Vector3, bool, Space) and InsertAfter(CurvySplineSegment, Vector3, bool, Space) and Add(Vector3[], Space) instead

public CurvySplineSegment[] Add(params Vector3[] controlPointsLocalPositions)

Parameters

controlPointsLocalPositions Vector3[]

The local position of the Control Points to add

Returns

CurvySplineSegment[]

The added Control Points

Add(Vector3[], Space)

Adds several Control Points at the end of the spline This method will Refresh() the spline and call the relevant events. If you want more control on the order of the added Control Points, their position, or whether Refresh() and events should be called, use the InsertBefore(CurvySplineSegment, Vector3, bool, Space) and InsertAfter(CurvySplineSegment, Vector3, bool, Space) instead

public CurvySplineSegment[] Add(Vector3[] controlPointsPositions, Space space)

Parameters

controlPointsPositions Vector3[]

The positions of the Control Points to add

space Space

Whether the positions are in the local or global space

Returns

CurvySplineSegment[]

The added Control Points

Bezier(Vector3, Vector3, Vector3, Vector3, float)

Cubic-Beziere Interpolation

public static Vector3 Bezier(Vector3 T0, Vector3 P0, Vector3 P1, Vector3 T1, float f)

Parameters

T0 Vector3

HandleIn

P0 Vector3

Pn

P1 Vector3

Pn+1

T1 Vector3

HandleOut

f float

f in the range 0..1

Returns

Vector3

BezierTangent(Vector3, Vector3, Vector3, Vector3, float)

public static Vector3 BezierTangent(Vector3 T0, Vector3 P0, Vector3 P1, Vector3 T1, float f)

Parameters

T0 Vector3
P0 Vector3
P1 Vector3
T1 Vector3
f float

Returns

Vector3

CalculateCacheSize(int, float, float)

Gets the number of Cache Points needed for a certain part of a spline

public static int CalculateCacheSize(int density, float segmentLength, float maxPointsPerUnit)

Parameters

density int

A value between 1 and 100 included. When equal to 100, the number of cache points per world distance unit is equal to maxPointsPerUnit

segmentLength float

the length of the spline segment

maxPointsPerUnit float

Maximum number of Cache Points per world distance unit

Returns

int

CalculateSamplingPointsPerUnit(int, float)

Returns the (floating) number of sampling points per world distance unit.

public static float CalculateSamplingPointsPerUnit(int density, float maxPointsPerUnit)

Parameters

density int

A value between 1 and 100 included. When equal to 100, the number of sampling points per world distance unit is equal to maxPointsPerUnit

maxPointsPerUnit float

Maximum number of sampling points per world distance unit

Returns

float

CanControlPointHaveFollowUp(CurvySplineSegment)

Can this control point have a Follow-Up? This is true if the control point is the beginning of the first segment or the end of the last segment of an open spline

public bool CanControlPointHaveFollowUp(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

bool

CatmullRom(Vector3, Vector3, Vector3, Vector3, float)

Catmull-Rom Interpolation

public static Vector3 CatmullRom(Vector3 T0, Vector3 P0, Vector3 P1, Vector3 T1, float f)

Parameters

T0 Vector3

Pn-1 (In Tangent)

P0 Vector3

Pn

P1 Vector3

Pn+1

T1 Vector3

Pn+2 (Out Tangent)

f float

f in the range 0..1

Returns

Vector3

the interpolated position

ClampDistance(float, CurvyClamping)

Clamps absolute position

public float ClampDistance(float distance, CurvyClamping clamping)

Parameters

distance float
clamping CurvyClamping

Returns

float

ClampDistance(float, CurvyClamping, float, float)

Clamps absolute position

public float ClampDistance(float distance, CurvyClamping clamping, float min, float max)

Parameters

distance float
clamping CurvyClamping
min float
max float

Returns

float

ClampDistance(float, ref int, CurvyClamping)

Clamps absolute position and sets new direction

public float ClampDistance(float distance, ref int dir, CurvyClamping clamping)

Parameters

distance float
dir int
clamping CurvyClamping

Returns

float

ClampDistance(float, ref int, CurvyClamping, float, float)

Clamps absolute position and sets new direction

public float ClampDistance(float distance, ref int dir, CurvyClamping clamping, float min, float max)

Parameters

distance float
dir int
clamping CurvyClamping
min float
max float

Returns

float

Clear(bool)

Removes all control points

If true, the clearing of the spline is made undoable (CTRL+Z) in the editor
public void Clear(bool isUndoable = true)

Parameters

isUndoable bool

CompareTo(object)

public int CompareTo(object obj)

Parameters

obj object

Returns

int

Create()

Creates an empty spline

public static CurvySpline Create()

Returns

CurvySpline

Create(CurvySpline)

Creates an empty spline with the same settings as another spline

public static CurvySpline Create(CurvySpline takeOptionsFrom)

Parameters

takeOptionsFrom CurvySpline

another spline

Returns

CurvySpline

Delete(CurvySplineSegment, bool)

Deletes a Control Point

public void Delete(CurvySplineSegment controlPoint, bool skipRefreshingAndEvents = false)

Parameters

controlPoint CurvySplineSegment

a Control Point

skipRefreshingAndEvents bool

If true, the spline's Refresh() method will not be called, and the relevant events will not be triggered

Delete(CurvySplineSegment, bool, bool)

Deletes a Control Point

public void Delete(CurvySplineSegment controlPoint, bool skipRefreshingAndEvents, bool isUndoableDeletion)

Parameters

controlPoint CurvySplineSegment

a Control Point

skipRefreshingAndEvents bool

If true, the spline's Refresh() method will not be called, and the relevant events will not be triggered

isUndoableDeletion bool

If true, the destruction of the control point's game object is made undoable (CTRL+Z) in the editor

DistanceToSegment(float, CurvyClamping)

Gets the segment a certain distance lies within

public CurvySplineSegment DistanceToSegment(float distance, CurvyClamping clamping = CurvyClamping.Clamp)

Parameters

distance float

a distance in the range 0..Length

clamping CurvyClamping

clamping to use

Returns

CurvySplineSegment

a spline segment or null

DistanceToSegment(float, out float, CurvyClamping)

Gets the segment a certain distance lies within

public CurvySplineSegment DistanceToSegment(float distance, out float localDistance, CurvyClamping clamping = CurvyClamping.Clamp)

Parameters

distance float

a distance in the range 0..Length

localDistance float

gets the remaining distance inside the segment

clamping CurvyClamping

clamping to use

Returns

CurvySplineSegment

a spline segment

DistanceToSegment(float, out float, out bool, out bool, CurvyClamping)

Gets the segment a certain distance lies within

public CurvySplineSegment DistanceToSegment(float distance, out float localDistance, out bool isOnSegmentStart, out bool isOnSegmentEnd, CurvyClamping clamping = CurvyClamping.Clamp)

Parameters

distance float

a distance in the range 0..Length

localDistance float

gets the remaining distance inside the segment

isOnSegmentStart bool

Is True if the given distance is positioned at the returned segment's start

isOnSegmentEnd bool

Is True if the given distance is positioned at the returned segment's end

clamping CurvyClamping

clamping to use

Returns

CurvySplineSegment

a spline segment

DistanceToTF(float, CurvyClamping)

Converts a distance to a TF value TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float DistanceToTF(float distance, CurvyClamping clamping = CurvyClamping.Clamp)

Parameters

distance float

distance

clamping CurvyClamping

Clamping to use

Returns

float

a TF value in the range 0..1

Equalize(CurvySplineSegment, CurvySplineSegment)

Equalizes the segment length of a certain range

public void Equalize(CurvySplineSegment fromCP = null, CurvySplineSegment toCP = null)

Parameters

fromCP CurvySplineSegment

starting ControlPoint

toCP CurvySplineSegment

ending ControlPoint

Flip()

Flips the direction of the spline, i.e. the first Control Point will become the last and vice versa.

public void Flip()

GetApproximation(float, float, bool, Space)

Gets all Approximation points for a given spline part

public Vector3[] GetApproximation(float fromTF, float toTF, bool includeEndPoint = true, Space space = Space.Self)

Parameters

fromTF float

start TF

toTF float

end TF

includeEndPoint bool

Whether the end position should be included

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3[]

an array of Approximation points

GetControlPointIndex(CurvySplineSegment)

Index of the control point

public short GetControlPointIndex(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

short

GetFollowUpHeadingControlPoint(CurvySplineSegment, ConnectionHeadingEnum)

This method returns the Control Point next to the Follow-Up, based on the ConnectionHeadingEnum's value

public static CurvySplineSegment GetFollowUpHeadingControlPoint(CurvySplineSegment followUp, ConnectionHeadingEnum headingDirection)

Parameters

followUp CurvySplineSegment

The Control Point used as a Follow-Up

headingDirection ConnectionHeadingEnum

The head to direction

Returns

CurvySplineSegment

The Control Point the Follow-Up is heading to

GetInterpolatedMetadata<T, U>(float)

Gets an interpolated Metadata value for a certain TF

public U GetInterpolatedMetadata<T, U>(float tf) where T : CurvyInterpolatableMetadataBase<U>

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

Returns

U

The interpolated value. If no Metadata of specified type is present at the given tf, the default value of type U is returned

Type Parameters

T

Metadata type inheriting from CurvyInterpolatableMetadataBase

U

Metadata's Value type

GetMetadata<T>(float)

Gets metadata for a certain TF

public T GetMetadata<T>(float tf) where T : CurvyMetadataBase

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

Returns

T

the metadata

Type Parameters

T

Metadata type interfacing ICurvyMetadata

GetNearestPoint(Vector3, Space)

Gets the point on the spline that is the nearest to a given position

public Vector3 GetNearestPoint(Vector3 position, Space space)

Parameters

position Vector3

The input point's position

space Space

The space (local/object or global/world) in which the position and the returned value are expressed

Returns

Vector3

The nearest point on the spline to the given position, expressed in the space defined by the space parameter

Remarks

This method's precision and speed depend on the CacheDensity

GetNearestPointTF(Vector3)

Gets the TF value of the point on the spline that is the nearest to a given position TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float GetNearestPointTF(Vector3 localPosition)

Parameters

localPosition Vector3

The point's position expressed in the spline's local space

Returns

float

a TF value in the range 0..1. If spline has no segments the returned value will be -1

Remarks

This method's precision and speed depend on the CacheDensity

GetNearestPointTF(Vector3, int, int, Space)

Gets the TF value of the point on the spline that is the nearest to a given position TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float GetNearestPointTF(Vector3 position, int searchStartSegmentIndex = 0, int searchEndSegmentIndex = -1, Space space = Space.Self)

Parameters

position Vector3

The point's position

searchStartSegmentIndex int

the index of the first segment to include in the search. Set it to 0 to start searching from the spline's start

searchEndSegmentIndex int

the index of the last segment to include in the search. Set it to -1 to search until the spline's end

space Space

The space (local/object or global/world) in which the position is expressed

Returns

float

a TF value in the range 0..1. If spline has no segments the returned value will be -1

Remarks

This method's precision and speed depend on the CacheDensity

GetNearestPointTF(Vector3, Space)

Gets the TF value of the point on the spline that is the nearest to a given position TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float GetNearestPointTF(Vector3 position, Space space)

Parameters

position Vector3

The point's position

space Space

The space (local/object or global/world) in which the position is expressed

Returns

float

a TF value in the range 0..1. If spline has no segments the returned value will be -1

Remarks

This method's precision and speed depend on the CacheDensity

GetNearestPointTF(Vector3, out Vector3)

Gets the TF value of the point on the spline that is the nearest to a given position TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float GetNearestPointTF(Vector3 localPosition, out Vector3 nearestPoint)

Parameters

localPosition Vector3

The point's position expressed in the spline's local space

nearestPoint Vector3

the nearest point on the spline to the given localPosition, expressed in the local space

Returns

float

a TF value in the range 0..1. If spline has no segments the returned value will be -1

Remarks

This method's precision and speed depend on the CacheDensity

GetNearestPointTF(Vector3, out Vector3, out CurvySplineSegment, out float, int, int, Space)

Gets the TF value of the point on the spline that is the nearest to a given position TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float GetNearestPointTF(Vector3 position, out Vector3 nearestPoint, out CurvySplineSegment nearestSegment, out float nearestPointLocalF, int searchStartSegmentIndex = 0, int searchEndSegmentIndex = -1, Space space = Space.Self)

Parameters

position Vector3

The point's position

nearestPoint Vector3

the nearest point on the spline to the given position, expressed in the space defined by the space parameter

nearestSegment CurvySplineSegment

the nearest segment of the spline to the given position

nearestPointLocalF float

LocalF of the nearest point on the nearest segment

searchStartSegmentIndex int

the index of the first segment to include in the search. Set it to 0 to start searching from the spline's start

searchEndSegmentIndex int

the index of the last segment to include in the search. Set it to -1 to search until the spline's end

space Space

The space (local/object or global/world) in which the position is expressed

Returns

float

a TF value in the range 0..1. If spline has no segments the returned value will be -1

Remarks

This method's precision and speed depend on the CacheDensity

GetNearestPointTF(Vector3, out Vector3, int, int, Space)

Gets the TF value of the point on the spline that is the nearest to a given position TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float GetNearestPointTF(Vector3 position, out Vector3 nearestPoint, int searchStartSegmentIndex = 0, int searchEndSegmentIndex = -1, Space space = Space.Self)

Parameters

position Vector3

The point's position

nearestPoint Vector3

the nearest point on the spline to the given position, expressed in the space defined by the space parameter

searchStartSegmentIndex int

the index of the first segment to include in the search. Set it to 0 to start searching from the spline's start

searchEndSegmentIndex int

the index of the last segment to include in the search. Set it to -1 to search until the spline's end

space Space

The space (local/object or global/world) in which the position is expressed

Returns

float

a TF value in the range 0..1. If spline has no segments the returned value will be -1

Remarks

This method's precision and speed depend on the CacheDensity

GetNearestPointTF(Vector3, out Vector3, Space)

Gets the TF value of the point on the spline that is the nearest to a given position TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float GetNearestPointTF(Vector3 position, out Vector3 nearestPoint, Space space)

Parameters

position Vector3

The point's position

nearestPoint Vector3

the nearest point on the spline to the given position, expressed in the space defined by the space parameter

space Space

The space (local/object or global/world) in which the position is expressed

Returns

float

a TF value in the range 0..1. If spline has no segments the returned value will be -1

Remarks

This method's precision and speed depend on the CacheDensity

GetNextControlPoint(CurvySplineSegment)

The next control point on the spline. Is null if none. Follow-Up not considered

[CanBeNull]
public CurvySplineSegment GetNextControlPoint(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

CurvySplineSegment

GetNextControlPointIndex(CurvySplineSegment)

The index of the next control point on the spline. Is -1 if none. Follow-Up not considered

[CanBeNull]
public short GetNextControlPointIndex(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

short

GetNextControlPointUsingFollowUp(CurvySplineSegment)

The next control point. Is null if none. Follow-Up is considered

[CanBeNull]
public CurvySplineSegment GetNextControlPointUsingFollowUp(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

CurvySplineSegment

GetNextSegment(CurvySplineSegment)

The next control point on the spline if it starts a segment. Is null if none. Follow-Up not considered

[CanBeNull]
public CurvySplineSegment GetNextSegment(CurvySplineSegment segment)

Parameters

segment CurvySplineSegment

Returns

CurvySplineSegment

GetNormalsCache(Space)

Gets an array containing all approximation Up-Vectors

public SubArray<Vector3> GetNormalsCache(Space space)

Parameters

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

SubArray<Vector3>

an array of Up-Vectors

Remarks

Returns a copy of the internal cache

GetOrientationFast(float, bool, Space)

Gets a rotation looking to Tangent with the head upwards along the Up-Vector

public Quaternion GetOrientationFast(float tf, bool inverse = false, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

inverse bool

whether the orientation should be inversed or not

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Quaternion

a rotation, relative to the spline's local space

GetOrientationUpFast(float, Space)

Gets the Up vector of a point on the spline segment. Instead of computing the exact value, this method uses a linear interpolation between cached points for faster result

public Vector3 GetOrientationUpFast(float tf, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

GetPositionsCache(Space)

Gets an array containing all approximation points

public SubArray<Vector3> GetPositionsCache(Space space)

Parameters

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

SubArray<Vector3>

an array of world/local positions

Remarks

Returns a copy of the internal cache

GetPreviousControlPoint(CurvySplineSegment)

The previous control point on the spline. Is null if none. Follow-Up not considered

[CanBeNull]
public CurvySplineSegment GetPreviousControlPoint(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

CurvySplineSegment

GetPreviousControlPointIndex(CurvySplineSegment)

The index of the previous control point on the spline. Is -1 if none. Follow-Up not considered

[CanBeNull]
public short GetPreviousControlPointIndex(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

short

GetPreviousControlPointUsingFollowUp(CurvySplineSegment)

The previous control point. Is null if none. Follow-Up is considered

[CanBeNull]
public CurvySplineSegment GetPreviousControlPointUsingFollowUp(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

CurvySplineSegment

GetPreviousSegment(CurvySplineSegment)

The previous control point on the spline if it starts a segment. Is null if none. Follow-Up not considered.

[CanBeNull]
public CurvySplineSegment GetPreviousSegment(CurvySplineSegment segment)

Parameters

segment CurvySplineSegment

Returns

CurvySplineSegment

GetSegmentIndex(CurvySplineSegment)

Index of the segment that this control point starts. -1 if control point does not start a segment.

public short GetSegmentIndex(CurvySplineSegment segment)

Parameters

segment CurvySplineSegment

Returns

short

GetTangent(float, Space)

Gets the normalized tangent at a point on the spline segment

public Vector3 GetTangent(float tf, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

GetTangent(float, Vector3, Space)

Gets the normalized tangent at a point on the spline segment. This method is faster than GetTangent(float, Space) if you have already the position of the point. Instead of computing the exact value, this method uses a linear interpolation between cached points for faster result

public Vector3 GetTangent(float tf, Vector3 position, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

position Vector3

the position of the point at localF. In other words, the result of Interpolate(float, Space)

space Space

The space (local/object or global/world) in which the returned result and the position parameter are expressed

Returns

Vector3

GetTangentByDistance(float, Space)

Gets the normalized tangent at a point on the spline segment

public Vector3 GetTangentByDistance(float distance, Space space = Space.Self)

Parameters

distance float

The distance between the spline's start and the point you are interested in. Value should be in the range from 0 to Length inclusive

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

GetTangentByDistanceFast(float, Space)

Gets the normalized tangent at a point on the spline segment. Instead of computing the exact value, this method uses a linear interpolation between cached points for faster result

public Vector3 GetTangentByDistanceFast(float distance, Space space = Space.Self)

Parameters

distance float

The distance between the spline's start and the point you are interested in. Value should be in the range from 0 to Length inclusive

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

GetTangentFast(float, Space)

Gets the normalized tangent at a point on the spline segment. Instead of computing the exact value, this method uses a linear interpolation between cached points for faster result

public Vector3 GetTangentFast(float tf, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

GetTangentsCache(Space)

Gets an array containing all approximation tangents

public SubArray<Vector3> GetTangentsCache(Space space)

Parameters

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

SubArray<Vector3>

an array of tangents

Remarks

Returns a copy of the internal cache

InsertAfter(CurvySplineSegment, bool)

Inserts a Control Point after a given Control Point

public CurvySplineSegment InsertAfter(CurvySplineSegment controlPoint, bool skipRefreshingAndEvents = false)

Parameters

controlPoint CurvySplineSegment

A control point of the spline, behind which the new control point will be added. If null, the CP will be added at the end of the spline

skipRefreshingAndEvents bool

If true, the spline's Refresh() method will not be called, and the relevant events will not be triggered

Returns

CurvySplineSegment

the new Control Point

Remarks

If you add several Control Points in a row, using Add(params Vector3[]) will be more efficient

InsertAfter(CurvySplineSegment, Vector3, bool, Space)

Inserts a Control Point after a given Control Point

public CurvySplineSegment InsertAfter(CurvySplineSegment controlPoint, Vector3 position, bool skipRefreshingAndEvents = false, Space space = Space.World)

Parameters

controlPoint CurvySplineSegment

A control point of the spline, behind which the new control point will be added. If null, the CP will be added at the end of the spline

position Vector3

The position of the control point at its creation

skipRefreshingAndEvents bool

If true, the spline's Refresh() method will not be called, and the relevant events will not be triggered

space Space

Whether the position is in the local or global space

Returns

CurvySplineSegment

the new Control Point

Remarks

If you add several Control Points in a row, using Add(params Vector3[]) will be more efficient

InsertBefore(CurvySplineSegment, bool)

Inserts a Control Point before a given Control Point

public CurvySplineSegment InsertBefore(CurvySplineSegment controlPoint, bool skipRefreshingAndEvents = false)

Parameters

controlPoint CurvySplineSegment

A control point of the spline, before which the new control point will be added. If null, the CP will be added at the start of the spline

skipRefreshingAndEvents bool

If true, the spline's Refresh() method will not be called, and the relevant events will not be triggered

Returns

CurvySplineSegment

The created Control Point

Remarks

If you add several Control Points in a row, using Add(params Vector3[]) will be more efficient

InsertBefore(CurvySplineSegment, Vector3, bool, Space)

Inserts a Control Point before a given Control Point

public CurvySplineSegment InsertBefore(CurvySplineSegment controlPoint, Vector3 position, bool skipRefreshingAndEvents = false, Space space = Space.World)

Parameters

controlPoint CurvySplineSegment

A control point of the spline, before which the new control point will be added. If null, the CP will be added at the start of the spline

position Vector3

The position of the control point at its creation

skipRefreshingAndEvents bool

If true, the spline's Refresh() method will not be called, and the relevant events will not be triggered

space Space

Whether the position is in the local or global space

Returns

CurvySplineSegment

The created Control Point

Remarks

If you add several Control Points in a row, using Add(params Vector3[]) will be more efficient

Interpolate(float, Space)

Gets the position of a point on the spline segment

public Vector3 Interpolate(float tf, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

InterpolateAndGetTangent(float, out Vector3, out Vector3, Space)

Gets the position and normalized tangent at a point on the spline segment Is Faster than calling Interpolate(float, Space) and Interpolate(float, Space) separately

public void InterpolateAndGetTangent(float tf, out Vector3 position, out Vector3 tangent, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

position Vector3

the output position

tangent Vector3

the output tangent

space Space

The space (local/object or global/world) in which the returned result is expressed

InterpolateAndGetTangentFast(float, out Vector3, out Vector3, Space)

Gets the position and normalized tangent at a point on the spline segment Is Faster than calling Interpolate(float, Space) and Interpolate(float, Space) separately Instead of computing the exact value, this method uses a linear interpolation between cached points for faster result

public void InterpolateAndGetTangentFast(float tf, out Vector3 position, out Vector3 tangent, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

position Vector3

the output position

tangent Vector3

the output tangent

space Space

The space (local/object or global/world) in which the returned result is expressed

InterpolateByDistance(float, Space)

Gets the position of a point on the spline segment

public Vector3 InterpolateByDistance(float distance, Space space = Space.Self)

Parameters

distance float

The distance between the spline's start and the point you are interested in. Value should be in the range from 0 to Length inclusive

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

InterpolateByDistanceFast(float, Space)

Gets the position of a point on the spline segment. Instead of computing the exact value, this method uses a linear interpolation between cached points for faster result

public Vector3 InterpolateByDistanceFast(float distance, Space space = Space.Self)

Parameters

distance float

The distance between the spline's start and the point you are interested in. Value should be in the range from 0 to Length inclusive

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

InterpolateFast(float, Space)

Gets the position of a point on the spline segment. Instead of computing the exact value, this method uses a linear interpolation between cached points for faster result

public Vector3 InterpolateFast(float tf, Space space = Space.Self)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end. This is the "time" parameter used in the splines' formulas. A point's TF is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

space Space

The space (local/object or global/world) in which the returned result is expressed

Returns

Vector3

IsControlPointASegment(CurvySplineSegment)

Is the control point the start of a segment?

public bool IsControlPointASegment(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

bool

IsControlPointAnOrientationAnchor(CurvySplineSegment)

Is the control point an orientation anchor? The answer is related to the control point's serialized OrientationAnchor value, plus it's position in the spline.

public bool IsControlPointAnOrientationAnchor(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

bool

IsControlPointVisible(CurvySplineSegment)

Is the control point part of a segment (whether starting it or ending it)

public bool IsControlPointVisible(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

bool

IsPlanar(CurvyPlane)

Determines if the spline is at zero position on a certain plane

public bool IsPlanar(CurvyPlane plane)

Parameters

plane CurvyPlane

the plane the spline should be tested against

Returns

bool

true if the spline is on the plane

IsPlanar(out bool, out bool, out bool)

Is the spline a 2D spline contained in one of the main planes?

public bool IsPlanar(out bool isYZ, out bool isXZ, out bool isXY)

Parameters

isYZ bool

Is spline contained within the YZ plane

isXZ bool

Is spline contained within the XZ plane

isXY bool

Is spline contained within the XY plane

Returns

bool

True if the control points are planar along at least one axis; otherwise, false.

JoinWith(CurvySplineSegment)

Insert this spline after another spline's destination Control Point and delete this spline

public void JoinWith(CurvySplineSegment destCP)

Parameters

destCP CurvySplineSegment

the Control Point of the destination spline

MakePlanar(CurvyPlane)

Forces the spline to be at zero position on a certain plane

public void MakePlanar(CurvyPlane plane)

Parameters

plane CurvyPlane

the plane the should be on

MoveControlPoints(int, int, CurvySplineSegment)

Moves ControlPoints from this spline, inserting them after a destination ControlPoint of another spline

public void MoveControlPoints(int startIndex, int count, CurvySplineSegment destCP)

Parameters

startIndex int

ControlPointIndex of the first CP to move

count int

number of ControlPoints to move

destCP CurvySplineSegment

ControlPoint at the destination spline to insert after

Normalize()

Applies a spline's scale to it's Control Points and resets scale

public void Normalize()

Refresh()

Refreshs the spline

public void Refresh()

Remarks

This is called automatically on the next Update() if any changes are pending

SegmentToTF(CurvySplineSegment)

Gets a TF value from a segment TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float SegmentToTF(CurvySplineSegment segment)

Parameters

segment CurvySplineSegment

a segment

Returns

float

a TF value in the range 0..1

SegmentToTF(CurvySplineSegment, float)

Gets a TF value from a segment and a local F TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

public float SegmentToTF(CurvySplineSegment segment, float localF)

Parameters

segment CurvySplineSegment

a segment

localF float

F of this segment in the range 0..1

Returns

float

a TF value in the range 0..1

SetControlPointCount(int)

Adds or removes control points to match a given count

public void SetControlPointCount(int newCount)

Parameters

newCount int

SetDirty(CurvySplineSegment, SplineDirtyingType)

Marks a Control Point to get recalculated on next call to Refresh(). Will also mark connected control points and control points that depend on the current one through the Follow-Up feature.

public void SetDirty(CurvySplineSegment dirtyControlPoint, SplineDirtyingType dirtyingType)

Parameters

dirtyControlPoint CurvySplineSegment

the Control Point to dirty

dirtyingType SplineDirtyingType

Defines what aspect should be dirtied

SetDirtyAll()

Ensure the whole spline will be recalculated on next call to Refresh()

public void SetDirtyAll()

SetDirtyAll(SplineDirtyingType, bool)

Ensure the whole spline will be recalculated on next call to Refresh()

public void SetDirtyAll(SplineDirtyingType dirtyingType, bool dirtyConnectedControlPoints)

Parameters

dirtyingType SplineDirtyingType

Defines what aspect should be dirtied

dirtyConnectedControlPoints bool

Whether to mark control points of other splines as dirty when they are connected to any control point of this spline.

SetDirtyPartial(CurvySplineSegment, SplineDirtyingType)

Marks a Control Point to get recalculated on next call to Refresh(). Will also mark connected control points and control points that depend on the current one through the Follow-Up feature. Be aware, this method, and unlike SetDirty, will not mark as dirty the control points connected to the "controlPoint" parameter

public void SetDirtyPartial(CurvySplineSegment dirtyControlPoint, SplineDirtyingType dirtyingType)

Parameters

dirtyControlPoint CurvySplineSegment

the Control Point to dirty

dirtyingType SplineDirtyingType

Defines what aspect should be dirtied

SetFirstControlPoint(CurvySplineSegment)

Defines the given Control Point to be the first Control Point of the spline

public void SetFirstControlPoint(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

One of this spline's control points

SetFromString(string)

Event-friendly helper that sets a field or property value

public void SetFromString(string fieldAndValue)

Parameters

fieldAndValue string

e.g. "MyValue=42"

SetPivot(float, float, float, bool)

Sets the pivot of the spline

public Vector3 SetPivot(float xRel = 0, float yRel = 0, float zRel = 0, bool preview = false)

Parameters

xRel float

-1 to 1

yRel float

-1 to 1

zRel float

-1 to 1

preview bool

if true, only return the new pivot position

Returns

Vector3

the new pivot position

Simplify(CurvySplineSegment, CurvySplineSegment)

Simplifies the spline, i.e. remove segments from a certain range

public void Simplify(CurvySplineSegment fromCP = null, CurvySplineSegment toCP = null)

Parameters

fromCP CurvySplineSegment

starting ControlPoint

toCP CurvySplineSegment

ending ControlPoint

Split(CurvySplineSegment)

Splits this spline with the parameter controlPoint becoming the first Control Point of the new spline

public CurvySpline Split(CurvySplineSegment controlPoint)

Parameters

controlPoint CurvySplineSegment

Returns

CurvySpline

The new spline

Subdivide(CurvySplineSegment, CurvySplineSegment)

Subdivides the spline, i.e. adds additional segments to a certain range

public void Subdivide(CurvySplineSegment fromCP = null, CurvySplineSegment toCP = null)

Parameters

fromCP CurvySplineSegment

starting ControlPoint

toCP CurvySplineSegment

ending ControlPoint

SyncSplineFromHierarchy()

Rebuilds the ControlPoints list from the hierarchy. It sets the spline as Dirty

public void SyncSplineFromHierarchy()

TCB(Vector3, Vector3, Vector3, Vector3, float, float, float, float, float, float, float)

Kochanek-Bartels/TCB-Interpolation

public static Vector3 TCB(Vector3 T0, Vector3 P0, Vector3 P1, Vector3 T1, float f, float FT0, float FC0, float FB0, float FT1, float FC1, float FB1)

Parameters

T0 Vector3

Pn-1 (In Tangent)

P0 Vector3

Pn

P1 Vector3

Pn+1

T1 Vector3

Pn+2 (Out Tangent)

f float

f in the range 0..1

FT0 float

Start Tension

FC0 float

Start Continuity

FB0 float

Start Bias

FT1 float

End Tension

FC1 float

End Continuity

FB1 float

End Bias

Returns

Vector3

the interpolated position

TFToDistance(float, CurvyClamping)

Converts a TF value to a distance

public float TFToDistance(float tf, CurvyClamping clamping = CurvyClamping.Clamp)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

clamping CurvyClamping

Clamping to use

Returns

float

distance from spline's start

TFToSegment(float)

Gets the segment for a certain TF clamped to 0..1

public CurvySplineSegment TFToSegment(float tf)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

Returns

CurvySplineSegment

the segment the given TF is inside

TFToSegment(float, CurvyClamping)

Gets the segment for a certain TF

public CurvySplineSegment TFToSegment(float tf, CurvyClamping clamping)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

clamping CurvyClamping

Clamping to use

Returns

CurvySplineSegment

the segment the given TF is inside

TFToSegment(float, out float)

Gets the segment and the local F for a certain TF clamped to 0..1

public CurvySplineSegment TFToSegment(float tf, out float localF)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

localF float

gets the remaining localF in the range 0..1

Returns

CurvySplineSegment

the segment the given TF is inside

TFToSegment(float, out float, CurvyClamping)

Gets the segment and the local F for a certain TF

public CurvySplineSegment TFToSegment(float tf, out float localF, CurvyClamping clamping)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

localF float

gets the remaining localF in the range 0..1

clamping CurvyClamping

Clamping to use

Returns

CurvySplineSegment

the segment the given TF is inside

TFToSegment(float, out float, out bool, out bool, CurvyClamping)

Gets the segment and the local F for a certain TF

public CurvySplineSegment TFToSegment(float tf, out float localF, out bool isOnSegmentStart, out bool isOnSegmentEnd, CurvyClamping clamping)

Parameters

tf float

TF stands for Total Fragment. It's a value ranging from 0 to 1 inclusive. 0 means the spline's start and 1 means the spline's end.This is the "time" parameter used in the splines' formulas. A point's F is not proportional to its distance from the spline's start. Depending on the spline, a value of 0.5 does not always mean the middle, distance wise, of the spline

localF float

gets the remaining localF in the range 0..1

isOnSegmentStart bool

Is True if the given distance is positioned at the returned segment's start

isOnSegmentEnd bool

Is True if the given distance is positioned at the returned segment's end

clamping CurvyClamping

Clamping to use

Returns

CurvySplineSegment

the segment the given TF is inside

ToLocalDirection(Vector3)

Transforms direction from world space to local space

public Vector3 ToLocalDirection(Vector3 localDirection)

Parameters

localDirection Vector3

Returns

Vector3

ToLocalPosition(Vector3)

Transforms position from world space to local space

public Vector3 ToLocalPosition(Vector3 worldPosition)

Parameters

worldPosition Vector3

Returns

Vector3

ToWorldDirection(Vector3)

Transforms direction from local space to world space

public Vector3 ToWorldDirection(Vector3 localDirection)

Parameters

localDirection Vector3

Returns

Vector3

ToWorldPosition(Vector3)

Transforms position from local space to world space

public Vector3 ToWorldPosition(Vector3 localPosition)

Parameters

localPosition Vector3

Returns

Vector3