Class PathController
- Namespace
- FluffyUnderware.Curvy.Controllers
Controller working on Curvy Generator Paths
[AddComponentMenu("Curvy/Controllers/CG Path Controller")]
public class PathController : CurvyController
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourDTVersionedMonoBehaviourPathController
- Inherited Members
Properties
IsReady
Returns true if the controller has all it dependencies ready.
public override bool IsReady { get; }
Property Value
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
Path
Gets or sets the path to use
public CGDataReference Path { get; set; }
Property Value
PathData
Gets the actual CGPath data
public CGPath PathData { get; }
Property Value
Methods
AbsoluteToRelative(float)
Converts distance on source from absolute to relative position.
protected override float AbsoluteToRelative(float worldUnitDistance)
Parameters
worldUnitDistancefloatdistance 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
speedfloatcontroller's speed. Should be strictly positive
deltaTimefloatthe 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
tffloat
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
tffloatinterpolatedPositionVector3tangentVector3upVector3
GetOrientation(float)
Retrieve the source global Orientation/Up-Vector for a given relative position
protected override Vector3 GetOrientation(float tf)
Parameters
tffloat
Returns
- Vector3
GetTangent(float)
Gets global tangent for a given relative position
protected override Vector3 GetTangent(float tf)
Parameters
tffloat
Returns
- Vector3
RelativeToAbsolute(float)
Converts distance on source from relative to absolute position.
protected override float RelativeToAbsolute(float relativeDistance)
Parameters
relativeDistancefloatrelative 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
tffloatthe current virtual position (either TF or World Units)
directionMovementDirectionthe current direction
speedfloatcontroller's speed. Should be strictly positive
deltaTimefloatthe time that the controller should advance with. Should be strictly positive