Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
documentation:controllers [2016/06/29 16:04]
Jake
documentation:controllers [2018/06/07 17:32] (current)
_Aka_
Line 1: Line 1:
 ====== Controllers ====== ====== Controllers ======
 Controllers are used to align or move GameObjects to Curvy Splines and Curvy Generator data like extrusion volumes or paths. Controllers are used to align or move GameObjects to Curvy Splines and Curvy Generator data like extrusion volumes or paths.
- +  ​* Spline ControllerUse the Spline Controller to align or move GameObjects to Curvy Splines. 
-The following controllers are shipped with Curvy: +  ​* ​Path ControllerThis controller works with [[.:​generator:​start]] ​Paths 
- +  ​* ​Volume ControllerThis controller works with [[.:​generator:​start]] ​Volumes 
-  ​[[#Spline Controller]] +Here are the main parameters ​of the controllers:
-  * [[#Path Controller]] +
-  * [[#Volume Controller]] +
- +
-===== Spline Controller ===== +
-Use the Spline Controller to align or move GameObjects to Curvy Splines. +
-===== Path Controller ​===== +
-This controller works with Curvy Generator ​Paths +
-===== Volume Controller ​===== +
-This controller works with Curvy Generator ​Volumes +
- +
-===== Reference ===== +
-All controllers share the same base parameters:+
 ====General==== ====General====
 ==Update In== ==Update In==
 Determines when the controller is updated: Update, LateUpdate or FixedUpdate Determines when the controller is updated: Update, LateUpdate or FixedUpdate
-==Space== +==Spline/​Path/​Volume== 
-Whether to use world space or the object's local space+The source ​object ​the controller will follow
 ==Use Cache== ==Use Cache==
-Whether to use cached values when appropriate or not+//Spline Controller only.// 
 + 
 +Whether to use cached values when appropriate. Cached values are less precise but faster to use. 
 +====Position==== 
 +==Position Mode== 
 +Whether the position is a world unit (absolute) distance ​or relative distance. 
 +Relative positions are values from 0 to 1. For splines, relative position is the TF while for paths and volumes it is the ratio of the total length. 
 +==Position== 
 +The position, using the above mode
 ====Cross Position==== ====Cross Position====
-//VolumeController ​only//+//​Volume Controller ​only.//
  
-This section defines the lateral ​starting ​position +This section defines the lateral position:
-:+
 == Cross Range == == Cross Range ==
 Defines the range within the cross section the controller uses. The base point (the point '​0'​ refers to) can be altered by using [[.:​generator:​modules:​shapeextrusion#​Shift]]. Defines the range within the cross section the controller uses. The base point (the point '​0'​ refers to) can be altered by using [[.:​generator:​modules:​shapeextrusion#​Shift]].
-== Cross Initial ​Position == +== Cross Position == 
-Defines the initial ​position within the defined Cross Range+Defines the position within the defined Cross Range
 == Cross Clamping == == Cross Clamping ==
 Defines what to do when trying to move over the defined range Defines what to do when trying to move over the defined range
- 
-====Position==== 
-This section defines the starting position 
-==Position Mode== 
-Whether the starting position is entered in world unit distance or relative. 
-<note important>​For splines, relative position means TF while for paths and volumes it means percentage</​note>​ 
-==Initial Position== 
-The starting position, using the above mode 
- 
- 
- 
 ====Move==== ====Move====
 ==Move mode== ==Move mode==
-Determines ​how to move: +Determines ​whether the speed uses absolute ​or relative distances. See [[#Position Mode]] for more details about absolute and relative distances
-  * **Relative** - using either TF (splines) ​or percentage (Paths,​Volumes) +
-  * **AbsoluteExtrapolate** - using (faster) extrapolated distance (splines) +
-  * **AbsolutePrecise** - using calculated distance+
 ==Speed== ==Speed==
-The speed, using the above mode, or delta (if animated) +The speed of the movement 
-<note important>​Note that speed changes ​the movement ​direction **only** if it was "​0"​ before!</​note>​+==Direction== 
 +The direction of the movement
 ==Clamping== ==Clamping==
-Determines what to do when the source'​ end is reached:+Determines what to do when the source'​end is reached:
   * **Clamp** - controller will stop   * **Clamp** - controller will stop
-  * **Loop** - controller will start over at the opposite+  * **Loop** - controller will start over at the opposite ​side
   * **PingPong** - controller switches direction   * **PingPong** - controller switches direction
 ==Play automatically== ==Play automatically==
-When enabled, the controller will start playing ​after it's initialization +When enabled, the controller will start playing ​when entering the Play Mode. 
-==Adapt on change== +====Connections handling==== 
-Internally, all controllers store the position relative (TF or percentage). So if you dynamically change the length of the source (e.g. by adding Control Points to a spline), the controlled object "​warps"​ to a new position. Enabling this option prevents this by restoring the distance from start when the source changes.+//Spline Controller only.//
  
-==Animate== +This allows you to specify how a Spline Controller should move when reaching a [[.:​splines:​connections|Connection]]. You can set one of the following behaviors: 
-If enabled, ​the controller ​uses the speed value as a delta that will be applied over a period of time using the below options +  * **Use Current Spline**: ​the controller ​will continue moving on the current spline ​as if there were no connections. 
-==Animation== +  * **Use Follow Up Spline**: the controller ​will continue moving on the spline containing the Follow Up if there is any, otherwise will continue moving on the current spline. 
-The animation curve to applyX axis reflects ​the duration (% of Time Scale) while Y axis reflects ​the delta value to set (Speed %) +  * **Use Random Spline**: the controller continue moving on one of the connected splines, chosen randomly. 
-==Time Scale== +  * **Use Follow Up otherwise Random**: ​the controller will continue moving on the spline containing the Follow Up if there is any, otherwise will continue moving on one of the connected splines, chosen randomly. 
-The duration in seconds ​single animation sequence takes +  * **Use Custom behavior**: define your own connected splines selecting logic. You can do that by setting an instance of a class inheriting from ConnectedControlPointsSelector. 
-==Single Shot== +==Allow direction changes== 
-If enabled, ​the animation will only play once, then the controller stops +When enabled, this allows the controller to change its movement direction. If moving on Follow Up, it will use the Follow Up heading. If moving on a random connection, it will change direction to backward if it is a spline'​s end, or forward if it is a spline'​s start. 
-==Reset On Stop== +==Reject divergent splines== 
-If enabled, ​the controller will reset to it's initial position when the animation sequence ends+Whether splines that diverge from the current spline with more than a specific angle should be excluded from the randomly selected splines 
 +==Reject current spline== 
 +Whether ​the current spline should be excluded from the randomly selected splines
 ====Orientation==== ====Orientation====
-==Orientation Mode== +The controller defines the object'​s rotation by aligning a Source vector (from the controller'​s source) with a Target vector (from the controller'​s GameObject) 
-Determines ​how set set orientation+==Source== 
-  * **None** - no rotation is applied+Determines ​the source position
 +  * **None** - The rotation is maintained.
   * **Tangent** - the tangent (direction) is used   * **Tangent** - the tangent (direction) is used
   * **Orientation** - orientation (Up-Vector) is used   * **Orientation** - orientation (Up-Vector) is used
-==Orientation Axis== +==Target== 
-Determines the rotation axis to apply the above value to +Determines the rotation axis to align the above value to
-==Damping Direction== +
-Adds a damping to the Tangent/​Direction vector +
-==Damping Up== +
-Adds a damping to the Up/​Orientation vector+
 ==Ignore direction== ==Ignore direction==
-If enabled, ​only the forward direction will be considered, even if the object ​is moving with negative speedOtherwise the object will switch direction when moving backwards+//​Available ​only if Source ​is different than None.//
  
-<​note>​The below Offset parameters are available only if OrientationMode ​is set to 'Tangent' or 'Orientation'</note>+If enabled, the orientation ignore the movement direction. If not, when the controller ​is moving backward, the orientation flips direction. 
 +==Damping Direction time== 
 +Adds a [[https://​docs.unity3d.com/​ScriptReference/​Vector3.SmoothDamp.html|smooth damping]] ​to the Tangent/Direction vector with the specified duration 
 +==Damping Up== 
 +Adds a [[https://​docs.unity3d.com/​ScriptReference/​Vector3.SmoothDamp.html|smooth damping]] to the Up/Orientation ​vector with the specified duration 
 +====Offset==== 
 +//Available only if Source is different than None.//
  
 +Applies an offset (lateral movement) on the GameObject'​s position, based on the Up/​Orientation vector of the source.
 ==Offset Angle== ==Offset Angle==
-The Angle (-180 to 180) starting from the Up vector, defining the direction to offset+The Angle (-180 to 180) starting from the Up vector, defining the direction to offset ​with
 ==Offset Radius== ==Offset Radius==
-The distance to offset+The distance to offset ​with
 ==Compensate Offset== ==Compensate Offset==
-If enabled, ​curve distance deviation ​will be compensated+If enabled, ​the controller speed will be modified to take into consideration the longer or shorter distance to travel due to the offset
  
 ====Events==== ====Events====
-//(Spline Controller ​only)// +You can react to certain events by adding a handler to the following [[https://docs.unity3d.com/​Manual/​UnityEvents.html|UnityEvents]]:​ 
-See [[.:controllers:​events]]+ 
 +==OnInitialized== 
 +//Available for all controllers//​ 
 + 
 +Called when the controller is initialized. You usually don't need to wait for the controller to initialize before setting its properties. 
 + 
 +==OnControlPointReached== 
 +//Available for SplineController and UITextSplineController ​only// 
 + 
 +Called when moving over a Control Point 
 +==OnEndReached== 
 +//Available for SplineController and UITextSplineController only// 
 + 
 +Called when the end (or startof the source spline is reached 
 +==OnSwitch== 
 +//Available for SplineController and UITextSplineController only// 
 + 
 +Called when switching between splines. 
 +<note important>​When you add an event handler by code, be sure to call BindEvents() afterwards! Please support our [[https://​feedback.unity3d.com/​suggestions/​unityevent-make-unityeventbase-dot-count-public-or-add-a-way-to-determine-if-any-listener-is-set-at-all|request]] to being able to check for event handlers without feeding the GC!</​note>​
  
 ====Preview==== ====Preview====
-Lets you preview the movement in the editor!+Lets you start and stop a preview ​of the movement in Edit Mode