Curvy  7.1.0
CurvySpline Class Reference
+ Inheritance diagram for CurvySpline:
+ Collaboration diagram for CurvySpline:

Detailed Description

Curvy Spline class

Public Attributes

bool ShowGizmos = true
 Whether to show the Gizmos enabled in the view settings or not at all More...
 

Properties

bool AutoEndTangents [get, set]
 Whether the first/last Control Point should act as the end tangent, too. More...
 
float AutoHandleDistance [get, set]
 Gets or sets the default Handle distance for Bezier splines More...
 
float Bias [get, set]
 Global Bias More...
 
Bounds Bounds [get]
 The bounding box of the spline More...
 
int CacheDensity [get, set]
 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 More...
 
int CacheSize [get]
 Gets total Cache Size More...
 
bool CheckTransform [get, set]
 Whether the spline should automatically refresh when a Control Point's position change More...
 
bool Closed [get, set]
 Whether this spline is closed or not More...
 
float Continuity [get, set]
 Global Continuity More...
 
int ControlPointCount [get]
 Gets the number of Control Points More...
 
ReadOnlyCollection< CurvySplineSegmentControlPointsList [get]
 The list of control points More...
 
int Count [get]
 Gets the number of Segments More...
 
bool Dirty [get]
 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 More...
 
CurvySplineSegment FirstSegment [get]
 Gets the first segment of the spline More...
 
CurvySplineSegment FirstVisibleControlPoint [get]
 Gets the first visible Control Point (equals the first segment or this[0]) More...
 
Color GizmoColor [get, set]
 Gets or sets Spline color More...
 
Color GizmoSelectionColor [get, set]
 Gets or sets selected segment color More...
 
bool GlobalCoordinatesChangedThisFrame [get]
 Returns true if the global position, rotation or scale of the spline has changed this frame More...
 
CurvyInterpolation Interpolation [get, set]
 The interpolation method used by this spline More...
 
bool IsInitialized [get]
 Whether the spline is fully initialized and all segments loaded More...
 
CurvySplineSegment LastSegment [get]
 Gets the last segment of the spline More...
 
CurvySplineSegment LastVisibleControlPoint [get]
 Gets the last visible Control Point (i.e. the end CP of the last segment) More...
 
float Length [get]
 Gets the total length of the Spline or SplineGroup More...
 
float MaxPointsPerUnit [get, set]
 The maximum number of sampling points per world distance unit. Sampling is used in caching or shape extrusion for example More...
 
CurvyControlPointEvent OnAfterControlPointAdd [get, set]
 Callback after a Control Point has been added and the spline was refreshed More...
 
CurvySplineEvent OnAfterControlPointChanges [get, set]
 Callback after one or more Control Points have been added or deleted More...
 
CurvyControlPointEvent OnBeforeControlPointAdd [get, set]
 Callback before a Control Point is about to be added. Return false to cancel the execution More...
 
CurvyControlPointEvent OnBeforeControlPointDelete [get, set]
 Callback before a Control Point is about to be deleted. Return false to cancel the execution. More...
 
Action< CurvySplineOnGlobalCoordinatesChanged [get, set]
 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 More...
 
CurvySplineEvent OnRefresh [get, set]
 
CurvyOrientation Orientation [get, set]
 Orientation mode More...
 
bool RestrictTo2D [get, set]
 Whether to restrict Control Points to the local X/Y plane More...
 
float Tension [get, set]
 Global Tension More...
 
CurvySplineSegment this[int idx] [get]
 Gets the Segment at a certain index More...
 
CurvyUpdateMethod UpdateIn [get, set]
 
bool UsePooling [get, set]
 Whether to use GameObject pooling for Control Points at runtime More...
 
bool UseThreading [get, set]
 Whether to use threading where applicable or not. Threading is currently not supported when targeting WebGL and Universal Windows Platform More...
 

Public Member Functions

CurvySplineSegment 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 More...
 
CurvySplineSegment Add (Vector3 controlPointPosition, Space 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 More...
 
CurvySplineSegment[] Add (params Vector3[] controlPointsLocalPositions)
 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 More...
 
CurvySplineSegment[] Add (Vector3[] controlPointsPositions, Space 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 More...
 
bool CanControlPointHaveFollowUp (CurvySplineSegment controlPoint)
 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 More...
 
float ClampDistance (float distance, CurvyClamping clamping)
 Clamps absolute position More...
 
float ClampDistance (float distance, CurvyClamping clamping, float min, float max)
 Clamps absolute position More...
 
float ClampDistance (float distance, ref int dir, CurvyClamping clamping)
 Clamps absolute position and sets new direction More...
 
float ClampDistance (float distance, ref int dir, CurvyClamping clamping, float min, float max)
 Clamps absolute position and sets new direction More...
 
void Clear ()
 Removes all control points More...
 
 CurvySpline ()
 
void Delete (CurvySplineSegment controlPoint, bool skipRefreshingAndEvents=false)
 Deletes a Control Point More...
 
void Delete (CurvySplineSegment controlPoint, bool skipRefreshingAndEvents, bool isUndoableDeletion)
 Deletes a Control Point More...
 
CurvySplineSegment DistanceToSegment (float distance, CurvyClamping clamping=CurvyClamping.Clamp)
 Gets the segment a certain distance lies within More...
 
CurvySplineSegment DistanceToSegment (float distance, out float localDistance, CurvyClamping clamping=CurvyClamping.Clamp)
 Gets the segment a certain distance lies within More...
 
CurvySplineSegment DistanceToSegment (float distance, out float localDistance, out bool isOnSegmentStart, out bool isOnSegmentEnd, CurvyClamping clamping=CurvyClamping.Clamp)
 Gets the segment a certain distance lies within More...
 
float DistanceToTF (float distance, CurvyClamping clamping=CurvyClamping.Clamp)
 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 More...
 
void Equalize (CurvySplineSegment fromCP=null, CurvySplineSegment toCP=null)
 Equalizes the segment length of a certain range More...
 
void Flip ()
 Flips the direction of the spline, i.e. the first Control Point will become the last and vice versa. More...
 
Vector3[] GetApproximation (Space space=Space.Self)
 Gets an array containing all approximation points More...
 
Vector3[] GetApproximation (float fromTF, float toTF, bool includeEndPoint=true, Space space=Space.Self)
 Gets all Approximation points for a given spline part More...
 
Vector3[] GetApproximationPoints (float fromTF, float toTF, bool includeEndPoint=true, Space space=Space.Self)
 Gets all Approximation points for a given spline part More...
 
Vector3[] GetApproximationT (Space space=Space.Self)
 Gets an array containing all approximation tangents More...
 
Vector3[] GetApproximationUpVectors (Space space=Space.Self)
 Gets an array containing all approximation Up-Vectors More...
 
short GetControlPointIndex (CurvySplineSegment controlPoint)
 Index of the control point More...
 
short GetControlPointOrientationAnchorIndex (CurvySplineSegment controlPoint)
 The index of the control point being the orientation anchor for the anchor group containing the controlPoint Is -1 for non visible control points More...
 
GetInterpolatedMetadata< T, U > (float tf)
 Gets an interpolated Metadata value for a certain TF More...
 
GetMetadata< T > (float tf)
 Gets metadata for a certain TF More...
 
float GetNearestPointTF (Vector3 localPosition)
 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 More...
 
float GetNearestPointTF (Vector3 position, Space 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 More...
 
float GetNearestPointTF (Vector3 localPosition, out Vector3 nearestPoint)
 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 More...
 
float GetNearestPointTF (Vector3 position, out Vector3 nearestPoint, Space 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 More...
 
float GetNearestPointTF (Vector3 position, int searchStartSegmentIndex=0, int searchEndSegmentIndex=-1, Space space=Space.Self)
 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 More...
 
float GetNearestPointTF (Vector3 position, out Vector3 nearestPoint, int searchStartSegmentIndex=0, int searchEndSegmentIndex=-1, Space space=Space.Self)
 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 More...
 
float GetNearestPointTF (Vector3 position, out Vector3 nearestPoint, [CanBeNull] out CurvySplineSegment nearestSegment, out float nearestPointLocalF, int searchStartSegmentIndex=0, int searchEndSegmentIndex=-1, Space space=Space.Self)
 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 More...
 
CurvySplineSegment GetNextControlPoint (CurvySplineSegment controlPoint)
 The next control point on the spline. Is null if none. Follow-Up not considered More...
 
short GetNextControlPointIndex (CurvySplineSegment controlPoint)
 The index of the next control point on the spline. Is -1 if none. Follow-Up not considered More...
 
CurvySplineSegment GetNextControlPointUsingFollowUp (CurvySplineSegment controlPoint)
 The next control point. Is null if none. Follow-Up is considered More...
 
CurvySplineSegment GetNextSegment (CurvySplineSegment segment)
 The next control point on the spline if it starts a segment. Is null if none. Follow-Up not considered More...
 
Quaternion GetOrientationFast (float tf, bool inverse=false, Space space=Space.Self)
 Gets a rotation looking to Tangent with the head upwards along the Up-Vector More...
 
Vector3 GetOrientationUpFast (float tf, Space space=Space.Self)
 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 More...
 
CurvySplineSegment GetPreviousControlPoint (CurvySplineSegment controlPoint)
 The previous control point on the spline. Is null if none. Follow-Up not considered More...
 
short GetPreviousControlPointIndex (CurvySplineSegment controlPoint)
 The index of the previous control point on the spline. Is -1 if none. Follow-Up not considered More...
 
CurvySplineSegment GetPreviousControlPointUsingFollowUp (CurvySplineSegment controlPoint)
 The previous control point. Is null if none. Follow-Up is considered More...
 
CurvySplineSegment GetPreviousSegment (CurvySplineSegment segment)
 The previous control point on the spline if it starts a segment. Is null if none. Follow-Up not considered. More...
 
short GetSegmentIndex (CurvySplineSegment segment)
 Index of the segment that this control point starts. -1 if control point does not start a segment. More...
 
Vector3 GetTangent (float tf, Space space=Space.Self)
 Gets the normalized tangent at a point on the spline segment More...
 
Vector3 GetTangent (float tf, Vector3 position, Space space=Space.Self)
 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 More...
 
Vector3 GetTangentByDistance (float distance, Space space=Space.Self)
 Gets the normalized tangent at a point on the spline segment More...
 
Vector3 GetTangentByDistanceFast (float distance, Space space=Space.Self)
 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 More...
 
Vector3 GetTangentFast (float tf, Space space=Space.Self)
 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 More...
 
CurvySplineSegment InsertAfter (CurvySplineSegment controlPoint, bool skipRefreshingAndEvents=false)
 Inserts a Control Point after a given Control Point More...
 
CurvySplineSegment InsertAfter ([CanBeNull] CurvySplineSegment controlPoint, Vector3 position, bool skipRefreshingAndEvents=false, Space space=Space.World)
 Inserts a Control Point after a given Control Point More...
 
CurvySplineSegment InsertBefore (CurvySplineSegment controlPoint, bool skipRefreshingAndEvents=false)
 Inserts a Control Point before a given Control Point More...
 
CurvySplineSegment InsertBefore ([CanBeNull] CurvySplineSegment controlPoint, Vector3 position, bool skipRefreshingAndEvents=false, Space space=Space.World)
 Inserts a Control Point before a given Control Point More...
 
Vector3 Interpolate (float tf, Space space=Space.Self)
 Gets the position of a point on the spline segment More...
 
void InterpolateAndGetTangent (float tf, out Vector3 position, out Vector3 tangent, Space space=Space.Self)
 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 More...
 
void InterpolateAndGetTangentFast (float tf, out Vector3 position, out Vector3 tangent, Space space=Space.Self)
 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 More...
 
Vector3 InterpolateByDistance (float distance, Space space=Space.Self)
 Gets the position of a point on the spline segment More...
 
Vector3 InterpolateByDistanceFast (float distance, Space space=Space.Self)
 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 More...
 
Vector3 InterpolateFast (float tf, Space space=Space.Self)
 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 More...
 
Vector3 InterpolateScale (float tf)
 Gets an interpolated Scale for a certain TF More...
 
bool IsControlPointAnOrientationAnchor (CurvySplineSegment controlPoint)
 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. More...
 
bool IsControlPointASegment (CurvySplineSegment controlPoint)
 Is the control point the start of a segment? More...
 
bool IsControlPointVisible (CurvySplineSegment controlPoint)
 Is the control point part of a segment (whether starting it or ending it) More...
 
bool IsPlanar (out int ignoreAxis)
 Checks if the curve is planar More...
 
bool IsPlanar (out bool xplanar, out bool yplanar, out bool zplanar)
 Checks if the curve is planar More...
 
bool IsPlanar (CurvyPlane plane)
 Determines if the spline is at zero position on a certain plane More...
 
void JoinWith (CurvySplineSegment destCP)
 Insert this spline after another spline's destination Control Point and delete this spline More...
 
void MakePlanar (CurvyPlane plane)
 Forces the spline to be at zero position on a certain plane More...
 
void MakePlanar (int axis)
 Equalize one axis of the spline to match the first control points's value More...
 
void MoveControlPoints (int startIndex, int count, CurvySplineSegment destCP)
 Moves ControlPoints from this spline, inserting them after a destination ControlPoint of another spline More...
 
void Normalize ()
 Applies a spline's scale to it's Control Points and resets scale More...
 
void Refresh ()
 Refreshs the spline More...
 
float SegmentToTF (CurvySplineSegment segment)
 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 More...
 
float SegmentToTF (CurvySplineSegment segment, float localF)
 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 More...
 
void SetDirty (CurvySplineSegment dirtyControlPoint, SplineDirtyingType dirtyingType)
 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. More...
 
void SetDirtyAll ()
 Ensures the whole spline (curve & orientation) will be recalculated on next call to Refresh() More...
 
void SetDirtyAll (SplineDirtyingType dirtyingType, bool dirtyConnectedControlPoints)
 Ensure the whole spline will be recalculated on next call to Refresh() More...
 
void SetDirtyPartial (CurvySplineSegment dirtyControlPoint, SplineDirtyingType dirtyingType)
 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 More...
 
void SetFirstControlPoint (CurvySplineSegment controlPoint)
 Defines the given Control Point to be the first Control Point of the spline More...
 
void SetFromString (string fieldAndValue)
 Event-friendly helper that sets a field or property value More...
 
Vector3 SetPivot (float xRel=0, float yRel=0, float zRel=0, bool preview=false)
 Sets the pivot of the spline More...
 
void Simplify (CurvySplineSegment fromCP=null, CurvySplineSegment toCP=null)
 Simplifies the spline, i.e. remove segments from a certain range More...
 
CurvySpline Split (CurvySplineSegment controlPoint)
 Splits this spline with the parameter controlPoint becoming the first Control Point of the new spline More...
 
void Subdivide (CurvySplineSegment fromCP=null, CurvySplineSegment toCP=null)
 Subdivides the spline, i.e. adds additional segments to a certain range More...
 
void SyncSplineFromHierarchy ()
 Rebuilds the ControlPoints list from the hierarchy. It sets the spline as Dirty More...
 
float TFToDistance (float tf, CurvyClamping clamping=CurvyClamping.Clamp)
 Converts a TF value to a distance More...
 
CurvySplineSegment TFToSegment (float tf, out float localF, out bool isOnSegmentStart, out bool isOnSegmentEnd, CurvyClamping clamping)
 Gets the segment and the local F for a certain TF More...
 
CurvySplineSegment TFToSegment (float tf, out float localF, CurvyClamping clamping)
 Gets the segment and the local F for a certain TF More...
 
CurvySplineSegment TFToSegment (float tf, CurvyClamping clamping)
 Gets the segment for a certain TF More...
 
CurvySplineSegment TFToSegment (float tf)
 Gets the segment for a certain TF clamped to 0..1 More...
 
CurvySplineSegment TFToSegment (float tf, out float localF)
 Gets the segment and the local F for a certain TF clamped to 0..1 More...
 
Vector3 ToLocalDirection (Vector3 localDirection)
 Transforms direction from world space to local space More...
 
Vector3 ToLocalPosition (Vector3 worldPosition)
 Transforms position from world space to local space More...
 
Vector3 ToWorldDirection (Vector3 localDirection)
 Transforms direction from local space to world space More...
 
Vector3 ToWorldPosition (Vector3 localPosition)
 Transforms position from local space to world space More...
 

Static Public Member Functions

static Vector3 Bezier (Vector3 T0, Vector3 P0, Vector3 P1, Vector3 T1, float f)
 Cubic-Beziere Interpolation More...
 
static Vector3 BezierTangent (Vector3 T0, Vector3 P0, Vector3 P1, Vector3 T1, float f)
 
static int CalculateCacheSize (int density, float splineLength, float maxPointsPerUnit)
 Gets the number of Cache Points needed for a certain part of a spline More...
 
static float CalculateSamplingPointsPerUnit (int density, float maxPointsPerUnit)
 Returns the (floating) number of sampling points per world distance unit. More...
 
static Vector3 CatmullRom (Vector3 T0, Vector3 P0, Vector3 P1, Vector3 T1, float f)
 Catmull-Rom Interpolation More...
 
static CurvySpline Create ()
 Creates an empty spline More...
 
static CurvySpline Create (CurvySpline takeOptionsFrom)
 Creates an empty spline with the same settings as another spline More...
 
static CurvySplineSegment GetFollowUpHeadingControlPoint (CurvySplineSegment followUp, ConnectionHeadingEnum headingDirection)
 This method returns the Control Point next to the Follow-Up, based on the ConnectionHeadingEnum's value More...
 
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)
 Kochanek-Bartels/TCB-Interpolation More...
 

Protected Attributes

CurvyControlPointEvent m_OnAfterControlPointAdd = new CurvyControlPointEvent()
 
CurvySplineEvent m_OnAfterControlPointChanges = new CurvySplineEvent()
 
CurvyControlPointEvent m_OnBeforeControlPointAdd = new CurvyControlPointEvent()
 
CurvyControlPointEvent m_OnBeforeControlPointDelete = new CurvyControlPointEvent()
 
CurvySplineEvent m_OnRefresh = new CurvySplineEvent()
 

Constructor & Destructor Documentation

Member Function Documentation

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

Returns
The added Control Point
CurvySplineSegment Add ( Vector3  controlPointPosition,
Space  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

Parameters
controlPointPositionThe position of the Control Point to add
spaceWhether the position is in the local or global space
Returns
The added Control Points
CurvySplineSegment [] Add ( params Vector3[]  controlPointsLocalPositions)

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

Parameters
controlPointsLocalPositionsThe local position of the Control Points to add
Returns
The added Control Points
CurvySplineSegment [] Add ( Vector3[]  controlPointsPositions,
Space  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

Parameters
controlPointsPositionsThe positions of the Control Points to add
spaceWhether the positions are in the local or global space
Returns
The added Control Points
static Vector3 Bezier ( Vector3  T0,
Vector3  P0,
Vector3  P1,
Vector3  T1,
float  f 
)
static

Cubic-Beziere Interpolation

Parameters
T0HandleIn
P0Pn
P1Pn+1
T1HandleOut
ff in the range 0..1
Returns
static Vector3 BezierTangent ( Vector3  T0,
Vector3  P0,
Vector3  P1,
Vector3  T1,
float  f 
)
static
static int CalculateCacheSize ( int  density,
float  splineLength,
float  maxPointsPerUnit 
)
static

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

Parameters
densityA value between 1 and 100 included. When equal to 100, the number of cache points per world distance unit is equal to maxPointsPerUnit
splineLengththe length of the spline segment
maxPointsPerUnitMaximum number of Cache Points per world distance unit
static float CalculateSamplingPointsPerUnit ( int  density,
float  maxPointsPerUnit 
)
static

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

Parameters
densityA value between 1 and 100 included. When equal to 100, the number of sampling points per world distance unit is equal to maxPointsPerUnit
maxPointsPerUnitMaximum number of sampling points per world distance unit
Returns
bool CanControlPointHaveFollowUp ( CurvySplineSegment  controlPoint)

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

Parameters
controlPoint
Returns
static Vector3 CatmullRom ( Vector3  T0,
Vector3  P0,
Vector3  P1,
Vector3  T1,
float  f 
)
static

Catmull-Rom Interpolation

Parameters
T0Pn-1 (In Tangent)
P0Pn
P1Pn+1
T1Pn+2 (Out Tangent)
ff in the range 0..1
Returns
the interpolated position
float ClampDistance ( float  distance,
CurvyClamping  clamping 
)

Clamps absolute position

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

Clamps absolute position

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

Clamps absolute position and sets new direction

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

Clamps absolute position and sets new direction

void Clear ( )

Removes all control points

static CurvySpline Create ( )
static

Creates an empty spline

static CurvySpline Create ( CurvySpline  takeOptionsFrom)
static

Creates an empty spline with the same settings as another spline

Parameters
takeOptionsFromanother spline
void Delete ( CurvySplineSegment  controlPoint,
bool  skipRefreshingAndEvents = false 
)

Deletes a Control Point

Parameters
controlPointa Control Point
skipRefreshingAndEventsIf true, the spline's Refresh method will not be called, and the relevant events will not be triggered
void Delete ( CurvySplineSegment  controlPoint,
bool  skipRefreshingAndEvents,
bool  isUndoableDeletion 
)

Deletes a Control Point

Parameters
controlPointa Control Point
skipRefreshingAndEventsIf true, the spline's Refresh method will not be called, and the relevant events will not be triggered
isUndoableDeletionIf true, the destruction of the control point's game object is made undoable (CTRL+Z) in the editor
CurvySplineSegment DistanceToSegment ( float  distance,
CurvyClamping  clamping = CurvyClamping.Clamp 
)

Gets the segment a certain distance lies within

Parameters
distancea distance in the range 0..Length
clampingclamping to use
Returns
a spline segment or null
CurvySplineSegment DistanceToSegment ( float  distance,
out float  localDistance,
CurvyClamping  clamping = CurvyClamping.Clamp 
)

Gets the segment a certain distance lies within

Parameters
distancea distance in the range 0..Length
localDistancegets the remaining distance inside the segment
clampingclamping to use
Returns
a spline segment
CurvySplineSegment DistanceToSegment ( float  distance,
out float  localDistance,
out bool  isOnSegmentStart,
out bool  isOnSegmentEnd,
CurvyClamping  clamping = CurvyClamping.Clamp 
)

Gets the segment a certain distance lies within

Parameters
distancea distance in the range 0..Length
localDistancegets the remaining distance inside the segment
isOnSegmentStartIs True if the given distance is positioned at the returned segment's start
isOnSegmentEndIs True if the given distance is positioned at the returned segment's end
clampingclamping to use
Returns
a spline segment
float DistanceToTF ( float  distance,
CurvyClamping  clamping = CurvyClamping.Clamp 
)

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

Parameters
distancedistance
clampingClamping to use
Returns
a TF value in the range 0..1
void Equalize ( CurvySplineSegment  fromCP = null,
CurvySplineSegment  toCP = null 
)

Equalizes the segment length of a certain range

Parameters
fromCPstarting ControlPoint
toCPending ControlPoint
void Flip ( )

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

Vector3 [] GetApproximation ( Space  space = Space.Self)

Gets an array containing all approximation points

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

This can be used to feed meshbuilders etc...

Returns
an array of world/local positions
Vector3 [] GetApproximation ( float  fromTF,
float  toTF,
bool  includeEndPoint = true,
Space  space = Space.Self 
)

Gets all Approximation points for a given spline part

Parameters
fromTFstart TF
toTFend TF
includeEndPointWhether the end position should be included
spaceThe space (local/object or global/world) in which the returned result is expressed
Returns
an array of Approximation points
Vector3 [] GetApproximationPoints ( float  fromTF,
float  toTF,
bool  includeEndPoint = true,
Space  space = Space.Self 
)

Gets all Approximation points for a given spline part

Parameters
fromTFstart TF
toTFend TF
includeEndPointWhether the end position should be included
spaceThe space (local/object or global/world) in which the returned result is expressed
Returns
an array of Approximation points
Vector3 [] GetApproximationT ( Space  space = Space.Self)

Gets an array containing all approximation tangents

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

This can be used to feed meshbuilders etc...

Returns
an array of tangents
Vector3 [] GetApproximationUpVectors ( Space  space = Space.Self)

Gets an array containing all approximation Up-Vectors

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

This can be used to feed meshbuilders etc...

Returns
an array of Up-Vectors
short GetControlPointIndex ( CurvySplineSegment  controlPoint)

Index of the control point

Parameters
controlPoint
Returns
short GetControlPointOrientationAnchorIndex ( CurvySplineSegment  controlPoint)

The index of the control point being the orientation anchor for the anchor group containing the controlPoint Is -1 for non visible control points

static CurvySplineSegment GetFollowUpHeadingControlPoint ( CurvySplineSegment  followUp,
ConnectionHeadingEnum  headingDirection 
)
static

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

Parameters
followUpThe Control Point used as a Follow-Up
headingDirectionThe head to direction
Returns
The Control Point the Follow-Up is heading to
U GetInterpolatedMetadata< T, U > ( float  tf)

Gets an interpolated Metadata value for a certain TF

Template Parameters
TMetadata type inheriting from CurvyInterpolatableMetadataBase
UMetadata's Value type
Parameters
tfTF 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
The interpolated value. If no Metadata of specified type is present at the given tf, the default value of type U is returned
Type Constraints
T :CurvyInterpolatableMetadataBase<U> 
T GetMetadata< T > ( float  tf)

Gets metadata for a certain TF

Template Parameters
TMetadata type interfacing ICurvyMetadata
Parameters
tfTF 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
the metadata
Type Constraints
T :CurvyMetadataBase 
float GetNearestPointTF ( Vector3  localPosition)

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

Parameters
localPositionThe point's position expressed in the spline's local space

This method's precision and speed depend on the CacheDensity

Returns
a TF value in the range 0..1. If spline has no segments the returned value will be -1
float GetNearestPointTF ( Vector3  position,
Space  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

Parameters
positionThe point's position
spaceThe space (local/object or global/world) in which the position is expressed

This method's precision and speed depend on the CacheDensity

Returns
a TF value in the range 0..1. If spline has no segments the returned value will be -1
float GetNearestPointTF ( Vector3  localPosition,
out Vector3  nearestPoint 
)

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

Parameters
localPositionThe point's position expressed in the spline's local space
nearestPointthe nearest point on the spline to the given localPosition

This method's precision and speed depend on the CacheDensity

Returns
a TF value in the range 0..1. If spline has no segments the returned value will be -1
float GetNearestPointTF ( Vector3  position,
out Vector3  nearestPoint,
Space  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

Parameters
positionThe point's position
nearestPointthe nearest point on the spline to the given position
spaceThe space (local/object or global/world) in which the position is expressed

This method's precision and speed depend on the CacheDensity

Returns
a TF value in the range 0..1. If spline has no segments the returned value will be -1
float GetNearestPointTF ( Vector3  position,
int  searchStartSegmentIndex = 0,
int  searchEndSegmentIndex = -1,
Space  space = Space.Self 
)

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

Parameters
positionThe point's position
searchStartSegmentIndexthe index of the first segment to include in the search. Set it to 0 to start searching from the spline's start
searchEndSegmentIndexthe index of the last segment to include in the search. Set it to -1 to search until the spline's end
spaceThe space (local/object or global/world) in which the position is expressed

This method's precision and speed depend on the CacheDensity

Returns
a TF value in the range 0..1. If spline has no segments the returned value will be -1
float GetNearestPointTF ( Vector3  position,
out Vector3  nearestPoint,
int  searchStartSegmentIndex = 0,
int  searchEndSegmentIndex = -1,
Space  space = Space.Self 
)

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

Parameters
positionThe point's position
nearestPointthe nearest point on the spline to the given position
searchStartSegmentIndexthe index of the first segment to include in the search. Set it to 0 to start searching from the spline's start
searchEndSegmentIndexthe index of the last segment to include in the search. Set it to -1 to search until the spline's end
spaceThe space (local/object or global/world) in which the position is expressed

This method's precision and speed depend on the CacheDensity

Returns
a TF value in the range 0..1. If spline has no segments the returned value will be -1
float GetNearestPointTF ( Vector3  position,
out Vector3  nearestPoint,
[CanBeNull] out CurvySplineSegment  nearestSegment,
out float  nearestPointLocalF,
int  searchStartSegmentIndex = 0,
int  searchEndSegmentIndex = -1,
Space  space = Space.Self 
)

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

Parameters
positionThe point's position
nearestPointthe nearest point on the spline to the given position
nearestSegmentthe nearest segment of the spline to the given position
nearestPointLocalFLocalF of the nearest point on the nearest segment
searchStartSegmentIndexthe index of the first segment to include in the search. Set it to 0 to start searching from the spline's start
searchEndSegmentIndexthe index of the last segment to include in the search. Set it to -1 to search until the spline's end
spaceThe space (local/object or global/world) in which the position is expressed

This method's precision and speed depend on the CacheDensity

Returns
a TF value in the range 0..1. If spline has no segments the returned value will be -1
CurvySplineSegment GetNextControlPoint ( CurvySplineSegment  controlPoint)

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

Parameters
controlPoint
Returns
short GetNextControlPointIndex ( CurvySplineSegment  controlPoint)

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

Parameters
controlPoint
Returns
CurvySplineSegment GetNextControlPointUsingFollowUp ( CurvySplineSegment  controlPoint)

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

Parameters
controlPoint
Returns
CurvySplineSegment GetNextSegment ( CurvySplineSegment  segment)

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

Parameters
segment
Returns
Quaternion GetOrientationFast ( float  tf,
bool  inverse = false,
Space  space = Space.Self 
)

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

Parameters
tfTF 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
inversewhether the orientation should be inversed or not
spaceThe space (local/object or global/world) in which the returned result is expressed
Returns
a rotation, relative to the spline's local space
Vector3 GetOrientationUpFast ( float  tf,
Space  space = Space.Self 
)

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

Parameters
tfTF 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
spaceThe space (local/object or global/world) in which the returned result is expressed
CurvySplineSegment GetPreviousControlPoint ( CurvySplineSegment  controlPoint)

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

Parameters
controlPoint
Returns
short GetPreviousControlPointIndex ( CurvySplineSegment  controlPoint)

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

Parameters
controlPoint
Returns
CurvySplineSegment GetPreviousControlPointUsingFollowUp ( CurvySplineSegment  controlPoint)

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

Parameters
controlPoint
Returns
CurvySplineSegment GetPreviousSegment ( CurvySplineSegment  segment)

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

Parameters
segment
Returns
short GetSegmentIndex ( CurvySplineSegment  segment)

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

Parameters
segment
Returns
Vector3 GetTangent ( float  tf,
Space  space = Space.Self 
)

Gets the normalized tangent at a point on the spline segment

Parameters
tfTF 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
spaceThe space (local/object or global/world) in which the returned result is expressed
Vector3 GetTangent ( float  tf,
Vector3  position,
Space  space = Space.Self 
)

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

Parameters
tfTF 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
positionthe position of the point at localF. In other words, the result of Interpolate(float, Space)
spaceThe space (local/object or global/world) in which the returned result and the position parameter are expressed
Vector3 GetTangentByDistance ( float  distance,
Space  space = Space.Self 
)

Gets the normalized tangent at a point on the spline segment

Parameters
distanceThe distance between the spline's start and the point you are interested in. Value should be in the range from 0 to Length inclusive
spaceThe space (local/object or global/world) in which the returned result is expressed
Vector3 GetTangentByDistanceFast ( float  distance,
Space  space = Space.Self 
)

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

Parameters
distanceThe distance between the spline's start and the point you are interested in. Value should be in the range from 0 to Length inclusive
spaceThe space (local/object or global/world) in which the returned result is expressed
Vector3 GetTangentFast ( float  tf,
Space  space = Space.Self 
)

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

Parameters
tfTF 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
spaceThe space (local/object or global/world) in which the returned result is expressed
CurvySplineSegment InsertAfter ( CurvySplineSegment  controlPoint,
bool  skipRefreshingAndEvents = false 
)

Inserts a Control Point after a given Control Point

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

Parameters
controlPointA 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
skipRefreshingAndEventsIf true, the spline's Refresh method will not be called, and the relevant events will not be triggered
Returns
the new Control Point
CurvySplineSegment InsertAfter ( [CanBeNull] CurvySplineSegment  controlPoint,
Vector3  position,
bool  skipRefreshingAndEvents = false,
Space  space = Space.World 
)

Inserts a Control Point after a given Control Point

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

Parameters
controlPointA 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
positionThe position of the control point at its creation
skipRefreshingAndEventsIf true, the spline's Refresh method will not be called, and the relevant events will not be triggered
spaceWhether the position is in the local or global space
Returns
the new Control Point
CurvySplineSegment InsertBefore ( CurvySplineSegment  controlPoint,
bool  skipRefreshingAndEvents = false 
)

Inserts a Control Point before a given Control Point

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

Parameters
controlPointA 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
Returns
The created Control Point
Parameters
skipRefreshingAndEventsIf true, the spline's Refresh method will not be called, and the relevant events will not be triggered
CurvySplineSegment InsertBefore ( [CanBeNull] CurvySplineSegment  controlPoint,
Vector3  position,
bool  skipRefreshingAndEvents = false,
Space  space = Space.World 
)

Inserts a Control Point before a given Control Point

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

Parameters
controlPointA 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
positionThe position of the control point at its creation
skipRefreshingAndEventsIf true, the spline's Refresh method will not be called, and the relevant events will not be triggered
spaceWhether the position is in the local or global space
Returns
The created Control Point
Vector3 Interpolate ( float  tf,
Space  space = Space.Self 
)

Gets the position of a point on the spline segment

Parameters
tfTF 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
spaceThe space (local/object or global/world) in which the returned result is expressed
void InterpolateAndGetTangent ( float  tf,
out Vector3  position,
out Vector3  tangent,
Space  space = Space.Self 
)

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

Parameters
tfTF 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
positionthe output position
tangentthe output tangent
spaceThe space (local/object or global/world) in which the returned result is expressed
void InterpolateAndGetTangentFast ( float  tf,
out Vector3  position,
out Vector3  tangent,
Space  space = Space.Self 
)

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

Parameters
tfTF 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
positionthe output position
tangentthe output tangent
spaceThe space (local/object or global/world) in which the returned result is expressed
Vector3 InterpolateByDistance ( float  distance,
Space  space = Space.Self 
)

Gets the position of a point on the spline segment

Parameters
distanceThe distance between the spline's start and the point you are interested in. Value should be in the range from 0 to Length inclusive
spaceThe space (local/object or global/world) in which the returned result is expressed
Vector3 InterpolateByDistanceFast ( float  distance,
Space  space = Space.Self 
)

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

Parameters
distanceThe distance between the spline's start and the point you are interested in. Value should be in the range from 0 to Length inclusive
spaceThe space (local/object or global/world) in which the returned result is expressed
Vector3 InterpolateFast ( float  tf,
Space  space = Space.Self 
)

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

Parameters
tfTF 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
spaceThe space (local/object or global/world) in which the returned result is expressed
Vector3 InterpolateScale ( float  tf)

Gets an interpolated Scale for a certain TF

TF (Total Fragment) relates to the total length of the spline

Parameters
tfTF value reflecting position on spline(0..1)
Returns
the interpolated value
bool IsControlPointAnOrientationAnchor ( CurvySplineSegment  controlPoint)

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.

Parameters
controlPoint
Returns
bool IsControlPointASegment ( CurvySplineSegment  controlPoint)

Is the control point the start of a segment?

Parameters
controlPoint
Returns
bool IsControlPointVisible ( CurvySplineSegment  controlPoint)

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

Parameters
controlPoint
Returns
bool IsPlanar ( out int  ignoreAxis)

Checks if the curve is planar

Parameters
ignoreAxisreturns the axis that can be ignored (0=x,1=y,2=z)
Returns
true if a planar axis was found
bool IsPlanar ( out bool  xplanar,
out bool  yplanar,
out bool  zplanar 
)

Checks if the curve is planar

Parameters
xplanarwhether the x-axis is planar
yplanarwhether the y-axis is planar
zplanarwhether the z-axis is planar
Returns
true if at least on axis is planar
bool IsPlanar ( CurvyPlane  plane)

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

Parameters
planethe plane the spline should be tested against
Returns
true if the spline is on the plane
void JoinWith ( CurvySplineSegment  destCP)

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

Parameters
destCPthe Control Point of the destination spline
void MakePlanar ( CurvyPlane  plane)

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

Parameters
planethe plane the should be on
void MakePlanar ( int  axis)

Equalize one axis of the spline to match the first control points's value

Parameters
axisthe axis to equalize (0=x,1=y,2=z)
void MoveControlPoints ( int  startIndex,
int  count,
CurvySplineSegment  destCP 
)

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

Parameters
startIndexControlPointIndex of the first CP to move
countnumber of ControlPoints to move
destCPControlPoint at the destination spline to insert after
void Normalize ( )

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

void Refresh ( )

Refreshs the spline

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

float SegmentToTF ( CurvySplineSegment  segment)

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

Parameters
segmenta segment
Returns
a TF value in the range 0..1
float SegmentToTF ( CurvySplineSegment  segment,
float  localF 
)

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

Parameters
segmenta segment
localFF of this segment in the range 0..1
Returns
a TF value in the range 0..1
void SetDirty ( CurvySplineSegment  dirtyControlPoint,
SplineDirtyingType  dirtyingType 
)

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.

Parameters
dirtyControlPointthe Control Point to dirty
dirtyingTypeDefines what aspect should be dirtied
void SetDirtyAll ( )

Ensures the whole spline (curve & orientation) will be recalculated on next call to Refresh()

void SetDirtyAll ( SplineDirtyingType  dirtyingType,
bool  dirtyConnectedControlPoints 
)

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

Parameters
dirtyingTypeDefines what aspect should be dirtied
dirtyConnectedControlPointswhether to set dirty other splines's control points connected to one of this spline's control points
void SetDirtyPartial ( CurvySplineSegment  dirtyControlPoint,
SplineDirtyingType  dirtyingType 
)

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

Parameters
dirtyControlPointthe Control Point to dirty
dirtyingTypeDefines what aspect should be dirtied
void SetFirstControlPoint ( CurvySplineSegment  controlPoint)

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

Parameters
controlPointOne of this spline's control points
void SetFromString ( string  fieldAndValue)

Event-friendly helper that sets a field or property value

Parameters
fieldAndValuee.g. "MyValue=42"
Vector3 SetPivot ( float  xRel = 0,
float  yRel = 0,
float  zRel = 0,
bool  preview = false 
)

Sets the pivot of the spline

Parameters
xRel-1 to 1
yRel-1 to 1
zRel-1 to 1
previewif true, only return the new pivot position
Returns
the new pivot position
void Simplify ( CurvySplineSegment  fromCP = null,
CurvySplineSegment  toCP = null 
)

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

Parameters
fromCPstarting ControlPoint
toCPending ControlPoint
CurvySpline Split ( CurvySplineSegment  controlPoint)

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

Returns
The new spline
void Subdivide ( CurvySplineSegment  fromCP = null,
CurvySplineSegment  toCP = null 
)

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

Parameters
fromCPstarting ControlPoint
toCPending ControlPoint
void SyncSplineFromHierarchy ( )

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

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 
)
static

Kochanek-Bartels/TCB-Interpolation

Parameters
T0Pn-1 (In Tangent)
P0Pn
P1Pn+1
T1Pn+2 (Out Tangent)
ff in the range 0..1
FT0Start Tension
FC0Start Continuity
FB0Start Bias
FT1End Tension
FC1End Continuity
FB1End Bias
Returns
the interpolated position
float TFToDistance ( float  tf,
CurvyClamping  clamping = CurvyClamping.Clamp 
)

Converts a TF value to a distance

Parameters
tfTF 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
clampingClamping to use
Returns
distance from spline's start
CurvySplineSegment TFToSegment ( float  tf,
out float  localF,
out bool  isOnSegmentStart,
out bool  isOnSegmentEnd,
CurvyClamping  clamping 
)

Gets the segment and the local F for a certain TF

Parameters
tfTF 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
localFgets the remaining localF in the range 0..1
isOnSegmentStartIs True if the given distance is positioned at the returned segment's start
isOnSegmentEndIs True if the given distance is positioned at the returned segment's end
clampingClamping to use
Returns
the segment the given TF is inside
CurvySplineSegment TFToSegment ( float  tf,
out float  localF,
CurvyClamping  clamping 
)

Gets the segment and the local F for a certain TF

Parameters
tfTF 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
localFgets the remaining localF in the range 0..1
clampingClamping to use
Returns
the segment the given TF is inside
CurvySplineSegment TFToSegment ( float  tf,
CurvyClamping  clamping 
)

Gets the segment for a certain TF

Parameters
tfTF 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
clampingClamping to use
Returns
the segment the given TF is inside
CurvySplineSegment TFToSegment ( float  tf)

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

Parameters
tfTF 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
the segment the given TF is inside
CurvySplineSegment TFToSegment ( float  tf,
out float  localF 
)

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

Parameters
tfTF 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
localFgets the remaining localF in the range 0..1
Returns
the segment the given TF is inside
Vector3 ToLocalDirection ( Vector3  localDirection)

Transforms direction from world space to local space

Vector3 ToLocalPosition ( Vector3  worldPosition)

Transforms position from world space to local space

Vector3 ToWorldDirection ( Vector3  localDirection)

Transforms direction from local space to world space

Vector3 ToWorldPosition ( Vector3  localPosition)

Transforms position from local space to world space

Member Data Documentation

CurvyControlPointEvent m_OnAfterControlPointAdd = new CurvyControlPointEvent()
protected
CurvySplineEvent m_OnAfterControlPointChanges = new CurvySplineEvent()
protected
CurvyControlPointEvent m_OnBeforeControlPointAdd = new CurvyControlPointEvent()
protected
CurvyControlPointEvent m_OnBeforeControlPointDelete = new CurvyControlPointEvent()
protected
CurvySplineEvent m_OnRefresh = new CurvySplineEvent()
protected
bool ShowGizmos = true

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

Property Documentation

bool AutoEndTangents
getset

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

Ignored by linear splines and Bezier ones

float AutoHandleDistance
getset

Gets or sets the default Handle distance for Bezier splines

float Bias
getset

Global Bias

This only applies to TCB interpolation

Bounds Bounds
get

The bounding box of the spline

int CacheDensity
getset

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

int CacheSize
get

Gets total Cache Size

bool CheckTransform
getset

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

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

bool Closed
getset

Whether this spline is closed or not

AutoEndTangents's value can be updated depending on Close value

float Continuity
getset

Global Continuity

This only applies to TCB interpolation

int ControlPointCount
get

Gets the number of Control Points

ReadOnlyCollection<CurvySplineSegment> ControlPointsList
get

The list of control points

int Count
get

Gets the number of Segments

bool Dirty
get

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

CurvySplineSegment FirstSegment
get

Gets the first segment of the spline

CurvySplineSegment FirstVisibleControlPoint
get

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

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

Color GizmoColor
getset

Gets or sets Spline color

Color GizmoSelectionColor
getset

Gets or sets selected segment color

bool GlobalCoordinatesChangedThisFrame
get

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

See also
OnGlobalCoordinatesChanged
CurvyInterpolation Interpolation
getset

The interpolation method used by this spline

AutoEndTangents's value can be updated depending on Interpolation value

bool IsInitialized
get

Whether the spline is fully initialized and all segments loaded

CurvySplineSegment LastSegment
get

Gets the last segment of the spline

CurvySplineSegment LastVisibleControlPoint
get

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

Is null if spline has no segments

float Length
get

Gets the total length of the Spline or SplineGroup

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

float MaxPointsPerUnit
getset

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

CurvyControlPointEvent OnAfterControlPointAdd
getset

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

CurvySplineEvent OnAfterControlPointChanges
getset

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

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

CurvyControlPointEvent OnBeforeControlPointAdd
getset

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

CurvyControlPointEvent OnBeforeControlPointDelete
getset

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

Action<CurvySpline> OnGlobalCoordinatesChanged
getset

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

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

See also
GlobalCoordinatesChangedThisFrame
CurvySplineEvent OnRefresh
getset
CurvyOrientation Orientation
getset

Orientation mode

bool RestrictTo2D
getset

Whether to restrict Control Points to the local X/Y plane

float Tension
getset

Global Tension

This only applies to TCB interpolation

CurvySplineSegment this[int idx]
get

Gets the Segment at a certain index

Parameters
idxan index in the range 0..Count
Returns
the corresponding spline segment
CurvyUpdateMethod UpdateIn
getset
bool UsePooling
getset

Whether to use GameObject pooling for Control Points at runtime

bool UseThreading
getset

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


The documentation for this class was generated from the following files: