# Flyby

Flyby generates a motion path procedurally based on either a starting position, destination, or midpoint reached at a specific time. The path may be linear with a fixed heading or using an object's rotation to create all sorts of curves and spirals, which would otherwise be difficult to achieve using a [Motion Path](https://axongenesis.gitbook.io/timeflow/reference/behaviors/animation/motion-path) or other means.

{% embed url="<https://www.youtube.com/watch?v=VUWSAa8SG6s>" %}

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FbPqCtB9ilRb3PcdL1S8K%2Fimage.png?alt=media&#x26;token=68214f3e-34eb-475b-b05f-90780b226b78" alt=""><figcaption><p>An example Flyby path displayed in the Scene view. The path is auto-generated from the object's rotation and velocity.</p></figcaption></figure>

{% hint style="info" %}
**Flyby does not generate rotation**

Rotation may be used as input or ignored by Flyby, but it does not directly apply rotation. Flyby sets position only and expects rotation to be handled by other animation channels. To create rotation from a generated path, see [Auto Rotate](https://axongenesis.gitbook.io/timeflow/reference/behaviors/automation/auto-rotate).
{% endhint %}

{% hint style="success" %}
To add Flyby, right-click on the object in the Timeflow view and select:

**Add Automation > Flyby**
{% endhint %}

## Flyby Channel

Flyby initially has 1 channel with a single special type of keyframe at the target time. The duration of the flyby is indicated by the bar extending from the keyframe, which may either be centered, before, or after depending on the mode selected.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FkYfJOuQw07mwEmFZJnS1%2Fimage.png?alt=media&#x26;token=509121f3-f725-4bed-9293-ba3b10301d6d" alt=""><figcaption><p>When a new Flyby instance is added, its keyframe is set to the current time.</p></figcaption></figure>

{% hint style="warning" %}
The keyframe may be selected, moved, and included in edit operations, however cannot be deleted nor can any new keyframes be added to the Flyby channel.
{% endhint %}

To generate a path that supports multiple keyframes, see [Motion Path](https://axongenesis.gitbook.io/timeflow/reference/behaviors/animation/motion-path).

## Flyby Editor

Select the game object to view the Flyby settings in the Inspector view.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F1nS93eiR9VKMUuvMKFGa%2Fimage.png?alt=media&#x26;token=0e371444-056e-490c-9420-a33f7eb0f52d" alt=""><figcaption><p>Default settings for Flyby.</p></figcaption></figure>

### Positioning Mode

Sets the anchor position and time by which the path is generated.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FljyISCTHeGxPVE9kXrMr%2Fimage.png?alt=media&#x26;token=1b288659-b4e5-4948-948e-c054dad38ff6" alt=""><figcaption><p>Use the Position Mode drop-down menu to select 1 of 3 modes, described below.</p></figcaption></figure>

{% hint style="info" %}
Position is defined in local coordinates.&#x20;
{% endhint %}

{% hint style="success" %}
The position remains fixed (to the start, end, or midpoint depending on the mode selected) no matter what changes are made to velocity or heading. This anchors the path at the specified position and time making adjustments much easier.
{% endhint %}

#### Flyby Position

Generates a path that passes thru the Flyby Position at the designated time.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FbiqMDV0en4u1vqToaYup%2Fimage.png?alt=media&#x26;token=5c4aee9d-f113-424a-b4b6-9a33b43b0b5f" alt=""><figcaption><p>The duration is centered on the target time, leading into and out of the flyby position.</p></figcaption></figure>

{% hint style="success" %}
Flyby mode is best suited for objects that need to meet at a specific point or cross another object. For example, use this to make objects pass by or in front of the camera.&#x20;
{% endhint %}

#### Start Position

Generates a path beginning at the designated time from the Start Position.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F6mFO7Q5npVHBao959vOg%2Fimage.png?alt=media&#x26;token=c54fc3d6-7671-4623-ae46-67108afd81f6" alt=""><figcaption><p>The path starts at the specified time, animating from there for the duration.</p></figcaption></figure>

{% hint style="success" %}
This mode is best for paths that require starting at a specific time and place, such as an airplane taking off or a ship leaving a dock.&#x20;
{% endhint %}

#### Destination Position

Generates a path arriving at the End Position at the designated time.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FwFlPQjZ3eg8tFwX9rlLt%2Fimage.png?alt=media&#x26;token=fd28e1f3-01bf-4e51-969c-00d9197311ee" alt=""><figcaption><p>The path ends at the specified time, animating the specified duration up to that point.</p></figcaption></figure>

{% hint style="success" %}
Use this mode to animate objects to a specific location with generated animation leading up to it. This mode is best for objects that animate up to a point and stop or hand off to other animation channels.
{% endhint %}

### At Time

Specifies the time which correlates directly to the keyframe on the channel. How time is used depends on the Positioning Mode as explained above.

### Duration

Sets the base duration used for calculating the motion path given the velocity and heading.&#x20;

#### Hold In / Out

When enabled, Flyby holds the transform position values outside of the active duration: before the start (Hold In) and after the end (Hold Out). Otherwise if disabled, Flyby is bypassed does not affect the object before/after the duration. This is primarily used to prevent Flyby from overwriting channels before it, to allow another Flyby or other behavior to have full control.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F0Uj9b3woXzPtlUQqS0LB%2Fimage.png?alt=media&#x26;token=aadc24c4-a9dd-48b8-b555-d96c2967dd3e" alt=""><figcaption><p>Flyby 1 has disabled Hold Out while Flyby 2 has disabled Hold In, so the two meet without overwriting one another.</p></figcaption></figure>

Hold In and Hold Out are depicted in the Track View (as shown above) with a ghosted region extending before and after the duration bar.&#x20;

{% hint style="info" %}

#### Channel Order

Note that channels are processed in the order listed and may result in one channel overwriting others before it. Whether the list displays top-down or first-to-last can be changed in the [Timeflow Preferences](https://axongenesis.gitbook.io/timeflow/user-guide/menus-and-shortcuts/preferences#reverse-channel-order).&#x20;
{% endhint %}

### Orientation

Sets the overall rotation of the whole path.  Use orientation to alter the direction and/or pivot the entire path around the target position.&#x20;

{% hint style="warning" %}
Orientation does not change the object rotation, only the path, so may result in misalignment. To orient the entire path and object together, use a parent object to rotate and place the path.
{% endhint %}

### Direction

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FOZeiO6RWCipzWJEQofdm%2Fimage.png?alt=media&#x26;token=b790278c-55bd-4ab0-9e8d-1d3ea808eb4b" alt=""><figcaption></figcaption></figure>

Determines the heading to generate the motion path from. The first six options listed are cardinal directions for creating simple linear paths along an axis (in local space), as shown below.

<div align="left"><figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FwQe8tolvWifhazphvWlC%2Fimage.png?alt=media&#x26;token=2e410f67-fdc9-4a33-a889-25aea0b7ca44" alt=""><figcaption></figcaption></figure></div>

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FZBWctEwOiWjzzSTkiC70%2Fimage.png?alt=media&#x26;token=5cf7e216-e20f-4784-95ce-c5797ebd6d16" alt=""><figcaption><p>Flyby generates a straight motion path along the heading direction selected.</p></figcaption></figure>

#### Reverse

Enable this to flip the direction of travel for the entire path. Toggle Reverse to correct an object traveling backwards.

{% hint style="info" %}
Reverse flips the approach direction of the object and may have result in mirroring the path spatially.
{% endhint %}

#### Custom Direction

Select this mode to enter a specific fixed direction based on a vector heading. This expects a normalized value (adding up to 1) though any value may be used.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2Fd0DRkbgyfVfoXymUkOlT%2Fimage.png?alt=media&#x26;token=bdea14cd-ac2e-421a-8050-084612139c5e" alt=""><figcaption><p>The heading is a direction along each axis, not a rotation value.</p></figcaption></figure>

{% hint style="warning" %}
While it may be tempting to animate the Heading (which is possible) it will not produce the results of steering an object as you might expect. Instead, use a [Rotation Channel](#use-rotation).&#x20;
{% endhint %}

### Rotation Channel

Generates a motion path using an input channel for rotation to curve the path. This pre-calculates the path by reading the full animation data and applying it over time, relative to the target [Position](#position) and [Positioning Mode](#positioning-mode) selected.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FLGdKLMdrSli3UQoMK4LE%2Fimage.png?alt=media&#x26;token=2bec36bd-6c5d-459d-8c25-2743faee4e5f" alt=""><figcaption><p>Any channel that animates rotation may be used, either single attribute or combined.</p></figcaption></figure>

{% hint style="warning" %}
Note that the selected input channel must be enabled and active to function.
{% endhint %}

As an example, [Tween ](https://axongenesis.gitbook.io/timeflow/reference/behaviors/animation/tween)has been applied to Local Rotation Y to create a simple oscillating movement from -90 to 90 degrees.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FsjcxGIsdzDcsiMq4afjs%2Fimage.png?alt=media&#x26;token=93a52dfe-9494-43fb-8801-456e1ec20ed2" alt=""><figcaption></figcaption></figure>

Using this rotation as the input channel for Flyby results in a S shaped curve, following the rotation of the object. Randomization could be added to Tween for more variability, or a keyframed animation channel could be used instead for more control.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F4xn2uO8wS1GjcW1Kp606%2Fimage.png?alt=media&#x26;token=94753de4-4c4b-4937-a53f-bde2b4819dbd" alt=""><figcaption><p>Flyby path generated from Tween rotation channel. </p></figcaption></figure>

{% hint style="info" %}
Any animation or behavior channel could potentially be used as rotation input.
{% endhint %}

#### Time Offset

Shifts the input channel forward or backward in time. If the value is 0, the rotation channel aligns to the Flyby channel as they appear in the Timeflow view, accounting for local and world offsets on each of the channels and objects.&#x20;

{% hint style="success" %}
Use Time Offset to look ahead or lag behind the actual rotation of the object. This may be for subtle or accentuated for effect.
{% endhint %}

{% hint style="info" %}
When the flyby duration extends beyond the time of the input channel, the path flattens out straight, as shown below. This isn't usually a problem since it is likely outside of the timeline. However, if this is encountered it could be fixed using time offsets.\ <img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FdrX2b9xaecYcPCKq4ijJ%2Fimage.png?alt=media&#x26;token=9fe13988-e5a9-4a97-98d3-8fd9646cc26b" alt="" data-size="original">

Also see [Time Offset](https://axongenesis.gitbook.io/timeflow/user-guide/timeflow-view/time-offset) for channels and objects.&#x20;
{% endhint %}

#### Steering

Controls how much rotation affects path curving. The default value is 1, which means every degree of rotation is represented in the curve 1:1.&#x20;

{% hint style="success" %}
Lower the steering value to reduce the curviness of a path, or set a higher value (up to 2) to make path curves more eccentric.&#x20;
{% endhint %}

### Velocity Mode

Determines the speed of the object, affecting the overall distance the path covers.&#x20;

<div align="left"><figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FdGrFh0AUy68ST7C2VQTG%2Fimage.png?alt=media&#x26;token=2b6e93d5-5731-43fb-b41c-ddd3c59c2464" alt=""><figcaption></figcaption></figure></div>

#### Constant

Sets a fixed velocity maintained throughout the animation.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FGYpphZISEHCo12kWTqjS%2Fimage.png?alt=media&#x26;token=be55ad27-1a1f-4896-919d-7a7be37893c0" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
Use Constant velocity for trains and planes and other Flybys that don't need any variation in speed.
{% endhint %}

#### Start to End

Generates a velocity curve with a beginning, middle, and end. This spans the flyby duration the same way no matter which positioning mode is used.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FWaNbD0P4yS6Ge5LZrGiL%2Fimage.png?alt=media&#x26;token=58c3bd1b-d71a-4d7d-ae0b-80a1ffaab28e" alt=""><figcaption><p>An example where the object starts from a stand still (0 velocity), accelerates to 10 units per second, and then comes to full stop at the end.</p></figcaption></figure>

Enable **Ease In Out** for smooth quadratic interpolation, or disable it for linear interpolation.

{% hint style="info" %}
When using Flyby mode, use the Midpoint velocity to set the speed of the object at the flyby position. This can be a value of 0 to come to a full stop. However, to have more control over the timing it may be better to use [Animation Curve](#animation-curve) or [Velocity Channel](#use-channel).&#x20;
{% endhint %}

{% hint style="success" %}
Negative velocity values are allowed and result in objects traveling in reverse. In the generated motion path this appears as a hard angle where the object changes direction. <br>

![](https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2Frc0OnSJcVHJNsJoXgqwP%2Fimage.png?alt=media\&token=84218bda-a582-4b29-8569-73521b0df659)

This is the point at which velocity is 0, as it transitions from a positive to negative value. For more control over velocity, see [Velocity Channel ](#use-channel)below.
{% endhint %}

#### Animation Curve

Uses a [Unity Animation Curve](https://docs.unity3d.com/Manual/EditingCurves.html) to map the velocity over the duration of the path.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2Ftvs7OCMwEuHZ6CqJigFf%2Fimage.png?alt=media&#x26;token=3104d44d-0d57-4552-859d-af87e6ab76d2" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The Velocity value is multiplied by the curve.&#x20;
{% endhint %}

Click in the Velocity Curve box (green line above) to open the curve editor. Use one of the presets at the bottom or create your own.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F5YoSmaSniL75DmuPvHW9%2Fimage.png?alt=media&#x26;token=e97d260f-3f3f-4d9f-bfa8-558b4921db4e" alt=""><figcaption><p>The curve represents the velocity over the full duration of the path.</p></figcaption></figure>

### Velocity Channel

This method of setting velocity offers the most control with full curve editing in the Timeflow view.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F9qabSG24br5ZWYPlhMQa%2Fimage.png?alt=media&#x26;token=72812789-78ea-4698-af9e-5a348602a3de" alt=""><figcaption></figcaption></figure>

When this mode is selected, a new Velocity channel is automatically added.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FBSGTgLzCXIoxkXc9BAG4%2Fimage.png?alt=media&#x26;token=d6eb0c47-5a13-4769-b5f7-30a400adeba9" alt=""><figcaption><p>Add <a href="../../../user-guide/timeflow-view/keyframes">keyframes</a> to the Velocity channel and/or use <a href="../../../user-guide/timeflow-view/channel-link">Channel Link</a>.</p></figcaption></figure>

Velocity is a standard keyframe channel and can be used as such, including the ability to link it with other channels and full curve editing and looping capabilities. The velocity is measured in world units and controls the speed of the object throughout the path (units per second).

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FqwuMdODBxbWH6YLuoBwp%2Fimage.png?alt=media&#x26;token=6a09c3ea-30a5-4d2b-9fac-0cbe2cfe75e0" alt=""><figcaption><p>The velocity channel may have any number of keyframes and use of all keyframe/curve options.</p></figcaption></figure>

## Gizmos in the Scene View

When the game object is selected, Flyby displays its motion path in the Scene view. The position and orientation of the path may be edited using the gizmo handles.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FaW16EYNxypNGDVVa3QYK%2Fimage.png?alt=media&#x26;token=dbc8d66f-a6d0-4c98-a5ce-ee458abcb70f" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Enable **Stay Visible** to keep the path displayed no matter if selected or not. However, the move and rotation handles are only displayed for the selected object.
{% endhint %}

### Move Tool

When the Move Tool is selected (in Unity's main toolbar) the Flyby position may be edited using the position handle, as shown below. This works the same as a regular position handle, but sets the Flyby Position, rather than the transform position (which is determined by path interpolation). &#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FuwvV1JtBMshdklzSznkm%2Fimage.png?alt=media&#x26;token=5e2aff63-7ad0-452e-9d59-771fa438a2f3" alt=""><figcaption><p>Click and drag the position handle to move the entire Flyby path, anchored at the Position.</p></figcaption></figure>

### Rotate Tool

Switch to the Rotate Tool to adjust the path [Orientation](#orientation). This affects the overall direction of the path, however does not rotate the object. To move and rotate a whole flyby path and object at once, see the tips below on [parenting](#undefined).

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FqalTIfBMjD8ICGX4UOBA%2Fimage.png?alt=media&#x26;token=d0a3eb69-b0e5-40b4-9283-ea05b020e08b" alt=""><figcaption></figcaption></figure>

## Further Possibilities

With the power of simple keyframing and combining Flyby with other generative behaviors such as [Tween](https://axongenesis.gitbook.io/timeflow/reference/behaviors/animation/tween), it's possible to create unlimited variations with complex results quickly and easily.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FklbwBeQxnCLbhhZFmHof%2Fimage.png?alt=media&#x26;token=c7cf2960-ccff-4e26-a120-f96a34f8ee4e" alt=""><figcaption><p>Using <a href="tween">Tween </a>to randomize rotation and <a href="../../../../user-guide/timeflow-view/graph-view#looping-animation">looping</a> Velocity curve to quickly create a complex path.</p></figcaption></figure>

### Using Parenting

Flyby works with hierarchical offsets, making it possible to move, rotate, and scale the entire path with the object. Add parent objects as needed to separate and layer transforms.&#x20;

{% hint style="warning" %}

### **Avoid Non-Uniform Parent Scaling**

If the inherited scale is non-uniform this may initially appear to squash the motion path, but as soon as the vector path is rebuilt it corrects itself to uniform scale. This is due to the way paths are constructed in world space and converted back to local space. Flyby still functions but this is an odd situation best to avoid.
{% endhint %}

### Using Multiple Flybys

Apply more than 1 Flyby to an object to create stack animations end to end or spaced out in time. &#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FeVDTpNr3Ga0Y0c1Vm46t%2Fimage.png?alt=media&#x26;token=2f1b8760-7e3b-452f-bb0a-c07b5a938452" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The channel order depends on the setting the Timeflow Preferences.
{% endhint %}

{% hint style="info" %}
When using multiple Flybys, [arrange the channels](https://axongenesis.gitbook.io/timeflow/timeflow-object/channels#channel-order) in the order desired.
{% endhint %}

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F3gY7wjXSmlWT68jTFspQ%2Fimage.png?alt=media&#x26;token=3fc6a796-86c0-4085-a834-29801a110622" alt=""><figcaption><p>Mu</p></figcaption></figure>
