Table of Contents

Class PathController

Controller working on Curvy Generator Paths

[AddComponentMenu("Curvy/Controllers/CG Path Controller")]
public class PathController : CurvyController
Inheritance
Object
Component
Behaviour
MonoBehaviour
DTVersionedMonoBehaviour
PathController
Inherited Members

Properties

IsReady

Returns true if the controller has all it dependencies ready.

public override bool IsReady { get; }

Property Value

bool

Remarks

A controller that is not initialized and has IsReady true, will be initialized at the next update call (automatically each frame or manually through Refresh().

Length

Gets the source's length

public override float Length { get; }

Property Value

float

Path

Gets or sets the path to use

public CGDataReference Path { get; set; }

Property Value

CGDataReference

PathData

Gets the actual CGPath data

public CGPath PathData { get; }

Property Value

CGPath

Methods

AbsoluteToRelative(float)

Converts distance on source from absolute to relative position.

protected override float AbsoluteToRelative(float worldUnitDistance)

Parameters

worldUnitDistance float

distance in world units from the source start. Should be already clamped

Returns

float

relative distance in the range 0..1

Advance(float, float)

Advance the controller and return the new position. This method will do side effect operations if needed, like updating some internal state, or triggering events.

protected override void Advance(float speed, float deltaTime)

Parameters

speed float

controller's speed. Should be strictly positive

deltaTime float

the time that the controller should advance with. Should be strictly positive

GetInterpolatedSourcePosition(float)

Retrieve the source global position for a given relative position (TF)

protected override Vector3 GetInterpolatedSourcePosition(float tf)

Parameters

tf float

Returns

Vector3

GetInterpolatedSourcePosition(float, out Vector3, out Vector3, out Vector3)

Retrieve the source global position, tangent and orientation for a given relative position (TF)

protected override void GetInterpolatedSourcePosition(float tf, out Vector3 interpolatedPosition, out Vector3 tangent, out Vector3 up)

Parameters

tf float
interpolatedPosition Vector3
tangent Vector3
up Vector3

GetOrientation(float)

Retrieve the source global Orientation/Up-Vector for a given relative position

protected override Vector3 GetOrientation(float tf)

Parameters

tf float

Returns

Vector3

GetTangent(float)

Gets global tangent for a given relative position

protected override Vector3 GetTangent(float tf)

Parameters

tf float

Returns

Vector3

RelativeToAbsolute(float)

Converts distance on source from relative to absolute position.

protected override float RelativeToAbsolute(float relativeDistance)

Parameters

relativeDistance float

relative distance from the source start. Should be already clamped

Returns

float

distance in world units from the source start

SimulateAdvance(ref float, ref MovementDirection, float, float)

Advance the controller and return the new position. Contrary to Advance(float, float), this method will not do any side effect operations, like updating some internal state, or triggering events

protected override void SimulateAdvance(ref float tf, ref MovementDirection direction, float speed, float deltaTime)

Parameters

tf float

the current virtual position (either TF or World Units)

direction MovementDirection

the current direction

speed float

controller's speed. Should be strictly positive

deltaTime float

the time that the controller should advance with. Should be strictly positive