Curvy  4.0.0
CurvyController Class Referenceabstract
+ Inheritance diagram for CurvyController:
+ Collaboration diagram for CurvyController:

Detailed Description

Controller base class

Public Types

enum  CurvyControllerState { Stopped, Playing, Paused }
 The play state of the controller More...
 
enum  MoveModeEnum { Relative = 0, AbsolutePrecise = 1 }
 Movement method options More...
 

Public Attributes

CurvyUpdateMethod UpdateIn = CurvyUpdateMethod.Update
 

Properties

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 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...
 

Protected Member Functions

abstract float AbsoluteToRelative (float worldUnitDistance)
 Converts distance on source from absolute to relative position. More...
 
abstract 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...
 
virtual void BindEvents ()
 Binds any external events More...
 
virtual 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...
 
virtual void Deinitialize ()
 
abstract Vector3 GetInterpolatedSourcePosition (float tf)
 Retrieve the source global position for a given relative position (TF) More...
 
abstract 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...
 
abstract Vector3 GetOrientation (float tf)
 Retrieve the source global Orientation/Up-Vector for a given relative position More...
 
abstract Vector3 GetTangent (float tf)
 Gets global tangent for a given relative position More...
 
virtual void Initialize ()
 
virtual void InitializedApplyDeltaTime (float deltaTime)
 Advances the controller state by deltaTime seconds. Is called only for intialized controllers More...
 
abstract float RelativeToAbsolute (float relativeDistance)
 Converts distance on source from relative to absolute position. More...
 
virtual void RestorePrePlayState ()
 
virtual void SavePrePlayState ()
 
abstract 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...
 
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

float m_Position
 

Member Enumeration Documentation

enum CurvyControllerState
strong

The play state of the controller

Enumerator
Stopped 
Playing 
Paused 
enum MoveModeEnum
strong

Movement method options

Enumerator
Relative 

Move by Percentage or TF (SplineController only)

AbsolutePrecise 

Move by calculated distance

Member Function Documentation

abstract float AbsoluteToRelative ( float  worldUnitDistance)
protectedpure virtual

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

Implemented in SplineController, VolumeController, and PathController.

abstract void Advance ( float  speed,
float  deltaTime 
)
protectedpure virtual

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

Implemented in SplineController, VolumeController, and PathController.

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.

virtual void BindEvents ( )
protectedvirtual

Binds any external events

Reimplemented in UITextSplineController.

virtual 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 in SplineController.

virtual void Deinitialize ( )
protectedvirtual
abstract Vector3 GetInterpolatedSourcePosition ( float  tf)
protectedpure virtual

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

Implemented in SplineController, VolumeController, and PathController.

abstract void GetInterpolatedSourcePosition ( float  tf,
out Vector3  interpolatedPosition,
out Vector3  tangent,
out Vector3  up 
)
protectedpure virtual

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

Implemented in SplineController, VolumeController, and PathController.

abstract Vector3 GetOrientation ( float  tf)
protectedpure virtual

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

Implemented in SplineController, VolumeController, and PathController.

abstract Vector3 GetTangent ( float  tf)
protectedpure virtual

Gets global tangent for a given relative position

Implemented in SplineController, VolumeController, and PathController.

virtual void Initialize ( )
protectedvirtual
virtual void InitializedApplyDeltaTime ( float  deltaTime)
protectedvirtual

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

Reimplemented in SplineController, and UITextSplineController.

virtual void OnAfterDeserialize ( )
virtual

Reimplemented in VolumeController.

void OnBeforeSerialize ( )
void Pause ( )

Pauses the controller. To unpause it call Play()

void Play ( )

Plays the controller. Calling this method while the controller is playing will have no effect.

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.

abstract float RelativeToAbsolute ( float  relativeDistance)
protectedpure virtual

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

Implemented in SplineController, VolumeController, and PathController.

virtual void RestorePrePlayState ( )
protectedvirtual

Reimplemented in SplineController.

virtual void SavePrePlayState ( )
protectedvirtual

Reimplemented in SplineController.

void SetFromString ( string  fieldAndValue)

Event-friedly helper that sets a field or property value

Parameters
fieldAndValuee.g. "MyValue=42"
abstract void SimulateAdvance ( ref float  tf,
ref MovementDirection  curyDirection,
float  speed,
float  deltaTime 
)
protectedpure virtual

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

Implemented in SplineController, VolumeController, and PathController.

void Stop ( )

Stops the controller, and restore its position (and other relevant states) to its state when starting playing

void TeleportBy ( float  distance,
MovementDirection  direction 
)

Teleports the controller to by a specific distance, while handling events triggering and connections.

Parameters
distanceA positive distance
directionDirection of teleportation

Internally, the teleport is handled as a movement of high speed on small time (0.001s). This will call ApplyDeltaTime with that small amount of time.

void TeleportTo ( float  newPosition)

Teleports the controller to a specific position, while handling events triggering and connections.

Internally, the teleport is handled as a movement of high speed on small time (0.001s). This will call ApplyDeltaTime with that small amount of time.

virtual void UnbindEvents ( )
protectedvirtual

Unbinds any external events

Reimplemented in UITextSplineController.

virtual void UserAfterInit ( )
protectedvirtual

Called after the controller is initialized

virtual void UserAfterUpdate ( )
protectedvirtual

Called after the controller has updated it's position or rotation

Member Data Documentation

float m_Position
protected

Property Documentation

float AbsolutePosition
getset

Gets or sets the absolute position on the source, respecting Clamping

CurvyClamping Clamping
getset

Gets or sets what to do when the source's end is reached

float DirectionDampingTime
getset

If non zero, the direction vector will not be updated instantly, but using a damping effect that will last the specified amount of time.

bool IgnoreDirection
getset

Should the controller's orientation ignore the movement direction?

bool isInitialized
getprotected
abstract bool IsReady
get

Returns true if the controller has all it dependencies ready.

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.

abstract float Length
get

Gets the source's length

Gets or sets the movement direction

MoveModeEnum MoveMode
getset

Gets or sets the movement mode to use

float OffsetAngle
getset

Gets or sets the angle to offset (-180° to 180° off Orientation)

bool OffsetCompensation
getset

Gets or sets whether to compensate offset distances in curvy paths

float OffsetRadius
getset

Gets or sets the offset radius

ControllerEvent OnInitialized
get

Invoked each time the controller finishes initialization

OrientationAxisEnum OrientationAxis
getset

Gets or sets the axis to apply the rotation to

OrientationModeEnum OrientationMode
getset

Gets or sets how to apply rotation

bool PlayAutomatically
getset

Gets or sets whether to start playing automatically

CurvyControllerState PlayState
get

The state (Playing, paused or stopped) of the controller

float Position
getset

Gets or sets the position on the source (relative or absolute, depending on MoveMode), respecting Clamping

CurvyPositionMode PositionMode
getset

Gets or sets the position mode to use

float RelativePosition
getset

Gets or sets the relative position on the source, respecting Clamping

float Speed
getset

Gets or sets the speed either in world units or relative, depending on MoveMode

virtual Transform Transform
get

Gets the transform being controlled by this controller.

float UpDampingTime
getset

If non zero, the up vector will not be updated instantly, but using a damping effect that will last the specified amount of time.


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