Curvy  4.0.0
SplineController Class Reference
+ Inheritance diagram for SplineController:
+ Collaboration diagram for SplineController:

Detailed Description

Controller working with Splines

Properties

bool AllowDirectionChange [get, set]
 Connections handling: When true, the controller will modify its direction to best fit the connected spline. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.FollowUpSpline, SplineControllerConnectionBehavior.RandomSpline, or SplineControllerConnectionBehavior.FollowUpOtherwiseRandom More...
 
SplineControllerConnectionBehavior ConnectionBehavior [get, set]
 Connections handling: What spline should the controller use when reaching a Connection More...
 
ConnectedControlPointsSelector ConnectionCustomSelector [get, set]
 Connections handling: A custom logic to select which connected spline to follow. Select a Script inheriting from SplineControllerConnectionBehavior. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.Custom More...
 
override bool IsReady [get]
 
bool IsSwitching [get]
 Gets whether the Controller is switching splines More...
 
override float Length [get]
 Gets the source's length More...
 
float MaxAllowedDivergenceAngle [get, set]
 Connections handling: Maximum allowed divergence angle in degrees. Considered when MaxAllowedDivergenceAngle is true. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.RandomSpline, or SplineControllerConnectionBehavior.FollowUpOtherwiseRandom More...
 
CurvySplineMoveEvent OnControlPointReached [get, set]
 Event raised when moving over a Control Point More...
 
CurvySplineMoveEvent OnEndReached [get, set]
 Event raised when reaching the extends of the source spline More...
 
CurvySplineMoveEvent OnSwitch [get, set]
 Event raised while switching splines More...
 
bool RejectCurrentSpline [get, set]
 Connections handling: Whether the current spline should be excluded from the randomly selected splines. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.RandomSpline, or SplineControllerConnectionBehavior.FollowUpOtherwiseRandom More...
 
bool RejectTooDivergentSplines [get, set]
 Connections handling: Whether splines that diverge from the current spline with more than MaxAllowedDivergenceAngle should be excluded from the randomly selected splines. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.RandomSpline, or SplineControllerConnectionBehavior.FollowUpOtherwiseRandom More...
 
virtual CurvySpline Spline [get, set]
 Gets or sets the spline to use More...
 
bool UseCache [get, set]
 Gets or sets whether spline's cache data should be used More...
 
- Properties inherited from CurvyController
float AbsolutePosition [get, set]
 Gets or sets the absolute position on the source, respecting Clamping More...
 
CurvyClamping Clamping [get, set]
 Gets or sets what to do when the source's end is reached More...
 
float DirectionDampingTime [get, set]
 If non zero, the direction vector will not be updated instantly, but using a damping effect that will last the specified amount of time. More...
 
bool IgnoreDirection [get, set]
 Should the controller's orientation ignore the movement direction? More...
 
bool isInitialized [get]
 
abstract bool IsReady [get]
 Returns true if the controller has all it dependencies ready. More...
 
abstract float Length [get]
 Gets the source's length More...
 
MovementDirection MovementDirection [get, set]
 Gets or sets the movement direction More...
 
MoveModeEnum MoveMode [get, set]
 Gets or sets the movement mode to use More...
 
float OffsetAngle [get, set]
 Gets or sets the angle to offset (-180° to 180° off Orientation) More...
 
bool OffsetCompensation [get, set]
 Gets or sets whether to compensate offset distances in curvy paths More...
 
float OffsetRadius [get, set]
 Gets or sets the offset radius More...
 
ControllerEvent OnInitialized [get]
 Invoked each time the controller finishes initialization More...
 
OrientationAxisEnum OrientationAxis [get, set]
 Gets or sets the axis to apply the rotation to More...
 
OrientationModeEnum OrientationMode [get, set]
 Gets or sets how to apply rotation More...
 
bool PlayAutomatically [get, set]
 Gets or sets whether to start playing automatically More...
 
CurvyControllerState PlayState [get]
 The state (Playing, paused or stopped) of the controller More...
 
float Position [get, set]
 Gets or sets the position on the source (relative or absolute, depending on MoveMode), respecting Clamping More...
 
CurvyPositionMode PositionMode [get, set]
 Gets or sets the position mode to use More...
 
float RelativePosition [get, set]
 Gets or sets the relative position on the source, respecting Clamping More...
 
float Speed [get, set]
 Gets or sets the speed either in world units or relative, depending on MoveMode More...
 
virtual Transform Transform [get]
 Gets the transform being controlled by this controller. More...
 
float UpDampingTime [get, set]
 If non zero, the up vector will not be updated instantly, but using a damping effect that will last the specified amount of time. More...
 

Public Member Functions

void CancelCurrentSwitch ()
 If is switching splines, cancels the current switch. More...
 
void FinishCurrentSwitch ()
 If is switching splines, instantly finishes the current switch. More...
 
 SplineController ()
 
virtual void SwitchTo (CurvySpline destinationSpline, float destinationTf, float duration)
 Start a spline switch. Should be called only on non stopped controllers. More...
 
- Public Member Functions inherited from CurvyController
void ApplyDeltaTime (float deltaTime)
 Advances the controller state by deltaTime seconds, without waiting for the automatic per frame update. Can initialize or deinitialize the controller if the right conditions are met. More...
 
virtual void OnAfterDeserialize ()
 
void OnBeforeSerialize ()
 
void Pause ()
 Pauses the controller. To unpause it call Play() More...
 
void Play ()
 Plays the controller. Calling this method while the controller is playing will have no effect. More...
 
void Refresh ()
 Forces the controller to update its state, without waiting for the automatic per frame update. Can initialize or deinitialize the controller if the right conditions are met. More...
 
void SetFromString (string fieldAndValue)
 Event-friedly helper that sets a field or property value More...
 
void Stop ()
 Stops the controller, and restore its position (and other relevant states) to its state when starting playing More...
 
void TeleportBy (float distance, MovementDirection direction)
 Teleports the controller to by a specific distance, while handling events triggering and connections. More...
 
void TeleportTo (float newPosition)
 Teleports the controller to a specific position, while handling events triggering and connections. More...
 

Static Public Member Functions

static float GetAngleBetweenConnectedSplines (CurvySplineSegment before, MovementDirection movementMode, CurvySplineSegment after, bool allowMovementModeChange)
 Get the direction change, in degrees, of controller caused by the crossing of a connection. More...
 

Protected Member Functions

override float AbsoluteToRelative (float worldUnitDistance)
 Converts distance on source from absolute to relative position. More...
 
override void Advance (float speed, float deltaTime)
 Advance the controller and return the new position. This method will do side effect operations if needed, like updating some internal state, or trigerring events. More...
 
override void ComputeTargetPositionAndRotation (out Vector3 targetPosition, out Vector3 targetUp, out Vector3 targetForward)
 Gets the position and rotation of the controller, ignoring any damping or other interpolations More...
 
override Vector3 GetInterpolatedSourcePosition (float tf)
 Retrieve the source global position for a given relative position (TF) More...
 
override void GetInterpolatedSourcePosition (float tf, out Vector3 interpolatedPosition, out Vector3 tangent, out Vector3 up)
 Retrieve the source global, tangent and orientatin for a given relative position (TF) More...
 
override Vector3 GetOrientation (float tf)
 Retrieve the source global Orientation/Up-Vector for a given relative position More...
 
override Vector3 GetTangent (float tf)
 Gets global tangent for a given relative position More...
 
override void InitializedApplyDeltaTime (float deltaTime)
 Advances the controller state by deltaTime seconds. Is called only for intialized controllers More...
 
override float RelativeToAbsolute (float relativeDistance)
 Converts distance on source from relative to absolute position. More...
 
override void RestorePrePlayState ()
 
override void SavePrePlayState ()
 
override void SimulateAdvance (ref float tf, ref MovementDirection curyDirection, float speed, float deltaTime)
 Advance the controller and return the new position. Contrary to Advance, this method will not do any side effect operations, like updating some internal state, or trigerring events More...
 
- Protected Member Functions inherited from CurvyController
virtual void BindEvents ()
 Binds any external events More...
 
virtual void Deinitialize ()
 
virtual void Initialize ()
 
virtual void UnbindEvents ()
 Unbinds any external events More...
 
virtual void UserAfterInit ()
 Called after the controller is initialized More...
 
virtual void UserAfterUpdate ()
 Called after the controller has updated it's position or rotation More...
 

Protected Attributes

CurvySpline m_Spline
 
- Protected Attributes inherited from CurvyController
float m_Position
 

Additional Inherited Members

- Public Types inherited from CurvyController
enum  CurvyControllerState { Stopped, Playing, Paused }
 The play state of the controller More...
 
enum  MoveModeEnum { Relative = 0, AbsolutePrecise = 1 }
 Movement method options More...
 
- Public Attributes inherited from CurvyController
CurvyUpdateMethod UpdateIn = CurvyUpdateMethod.Update
 

Constructor & Destructor Documentation

Member Function Documentation

override float AbsoluteToRelative ( float  worldUnitDistance)
protectedvirtual

Converts distance on source from absolute to relative position.

Parameters
worldUnitDistancedistance in world units from the source start. Should be already clamped
Returns
relative distance (TF) in the range 0..1

Implements CurvyController.

override void Advance ( float  speed,
float  deltaTime 
)
protectedvirtual

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

Parameters
speedcontroller's speed. Should be strictely positive
deltaTimethe time that the controller should advance with. Should be strictely positive

Implements CurvyController.

void CancelCurrentSwitch ( )

If is switching splines, cancels the current switch.

override void ComputeTargetPositionAndRotation ( out Vector3  targetPosition,
out Vector3  targetUp,
out Vector3  targetForward 
)
protectedvirtual

Gets the position and rotation of the controller, ignoring any damping or other interpolations

Parameters
targetPosition
targetUp
targetForward

Reimplemented from CurvyController.

void FinishCurrentSwitch ( )

If is switching splines, instantly finishes the current switch.

static float GetAngleBetweenConnectedSplines ( CurvySplineSegment  before,
MovementDirection  movementMode,
CurvySplineSegment  after,
bool  allowMovementModeChange 
)
static

Get the direction change, in degrees, of controller caused by the crossing of a connection.

Parameters
beforeThe control point the controller is on before crossing the connection
movementModeThe movement mode the controller has before crossing the connection
afterThe control point the controller is on after crossing the connection
allowMovementModeChangeIf true, the controller will change movemen mode to best fit the after control point. AllowDirectionChange
Returns
A positif angle in degrees
override Vector3 GetInterpolatedSourcePosition ( float  tf)
protectedvirtual

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

Implements CurvyController.

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

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

Implements CurvyController.

override Vector3 GetOrientation ( float  tf)
protectedvirtual

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

Implements CurvyController.

override Vector3 GetTangent ( float  tf)
protectedvirtual

Gets global tangent for a given relative position

Implements CurvyController.

override void InitializedApplyDeltaTime ( float  deltaTime)
protectedvirtual

Advances the controller state by deltaTime seconds. Is called only for intialized controllers

Reimplemented from CurvyController.

Reimplemented in UITextSplineController.

override float RelativeToAbsolute ( float  relativeDistance)
protectedvirtual

Converts distance on source from relative to absolute position.

Parameters
relativeDistancerelative distance (TF) from the source start. Should be already clamped
Returns
distance in world units from the source start

Implements CurvyController.

override void RestorePrePlayState ( )
protectedvirtual

Reimplemented from CurvyController.

override void SavePrePlayState ( )
protectedvirtual

Reimplemented from CurvyController.

override void SimulateAdvance ( ref float  tf,
ref MovementDirection  curyDirection,
float  speed,
float  deltaTime 
)
protectedvirtual

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

Parameters
tfthe current virtual position (either TF or World Units)
curyDirectionthe current direction
speedcontroller's speed. Should be strictely positive
deltaTimethe time that the controller should advance with. Should be strictely positive

Implements CurvyController.

virtual void SwitchTo ( CurvySpline  destinationSpline,
float  destinationTf,
float  duration 
)
virtual

Start a spline switch. Should be called only on non stopped controllers.

While switching is not finished, movement on destination spline will not fire events nore consider connections

Parameters
destinationSplinethe target spline to switch to
destinationTfthe target TF
durationduration of the switch phase

Member Data Documentation

CurvySpline m_Spline
protected

Property Documentation

bool AllowDirectionChange
getset

Connections handling: When true, the controller will modify its direction to best fit the connected spline. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.FollowUpSpline, SplineControllerConnectionBehavior.RandomSpline, or SplineControllerConnectionBehavior.FollowUpOtherwiseRandom

SplineControllerConnectionBehavior ConnectionBehavior
getset

Connections handling: What spline should the controller use when reaching a Connection

ConnectedControlPointsSelector ConnectionCustomSelector
getset

Connections handling: A custom logic to select which connected spline to follow. Select a Script inheriting from SplineControllerConnectionBehavior. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.Custom

override bool IsReady
get
bool IsSwitching
get

Gets whether the Controller is switching splines

override float Length
get

Gets the source's length

float MaxAllowedDivergenceAngle
getset

Connections handling: Maximum allowed divergence angle in degrees. Considered when MaxAllowedDivergenceAngle is true. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.RandomSpline, or SplineControllerConnectionBehavior.FollowUpOtherwiseRandom

CurvySplineMoveEvent OnControlPointReached
getset

Event raised when moving over a Control Point

CurvySplineMoveEvent OnEndReached
getset

Event raised when reaching the extends of the source spline

CurvySplineMoveEvent OnSwitch
getset

Event raised while switching splines

bool RejectCurrentSpline
getset

Connections handling: Whether the current spline should be excluded from the randomly selected splines. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.RandomSpline, or SplineControllerConnectionBehavior.FollowUpOtherwiseRandom

bool RejectTooDivergentSplines
getset

Connections handling: Whether splines that diverge from the current spline with more than MaxAllowedDivergenceAngle should be excluded from the randomly selected splines. Is used when ConnectionBehavior is equal to SplineControllerConnectionBehavior.RandomSpline, or SplineControllerConnectionBehavior.FollowUpOtherwiseRandom

virtual CurvySpline Spline
getset

Gets or sets the spline to use

bool UseCache
getset

Gets or sets whether spline's cache data should be used


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