Advanced custom controllers

While it's recommended to inherit your custom controllers from one of the existing Controllers, you may want to derive your controller directly from the controller's base class, CurvyController.

You only need this if you want a controller to use any other source than the ones provided (Spline, Path, Volume). Otherwise you can get almost the same functionality by overriding methods and properties of the higher level controllers, e.g. SplineController or PathController

Basics

Controllers share common functionality, e.g. moving with relative (%) or absolute (world units) speed. Almost all functionality is based on a few methods that convert units and provides the data needed. You'll have to override at least the following methods and properties:

Method/Property Purpose Remarks
Length Gets the total length of the source
AbsoluteToRelative() Convert absolute to relative distance
RelativeToAbsolute() Converts relative to absolute distance
GetInterpolatedSourcePosition() Gets position for a certain relative positon
GetOrientation() Gets Up vector for a certain relative position
GetTangent() Gets Direction vector for a certain relative position
Advance() Move on the source Needs to support all MoveModeEnum cases

More Control

To change or extend basic functionality you can override the following methods and properties:

Method/Property Purpose Remarks
GetRotation() Gets the final GameObject rotation
BindEvents() Bind external events Call this by yourself in Prepare(), OnEnable(), OnDisable() etc…)
UnbindEvents() Unbinds external events Call this by yourself in Prepare(), OnEnable(), OnDisable() etc…)

Examples

The best learning source is source! Take a look at the existing controllers: SplineController, PathController and VolumeController

Last modified: 2015/09/23 14:19 by Jake