Create flight paths based on destination and trajectory
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 or other means.
An example Flyby path displayed in the Scene view. The path is auto-generated from the object's rotation and velocity.
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.
To add Flyby, right-click on the object in the Timeflow view and select:
Add Automation > Flyby
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.
When a new Flyby instance is added, its keyframe is set to the current time.
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.
To generate a path that supports multiple keyframes, see Motion Path.
Flyby Editor
Select the game object to view the Flyby settings in the Inspector view.
Default settings for Flyby.
Positioning Mode
Sets the anchor position and time by which the path is generated.
Use the Position Mode drop-down menu to select 1 of 3 modes, described below.
Position is defined in local coordinates.
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.
Flyby Position
Generates a path that passes thru the Flyby Position at the designated time.
The duration is centered on the target time, leading into and out of the flyby position.
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.
Start Position
Generates a path beginning at the designated time from the Start Position.
The path starts at the specified time, animating from there for the duration.
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.
Destination Position
Generates a path arriving at the End Position at the designated time.
The path ends at the specified time, animating the specified duration up to that point.
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.
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.
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.
Flyby 1 has disabled Hold Out while Flyby 2 has disabled Hold In, so the two meet without overwriting one another.
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.
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.
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.
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.
Direction
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.
Flyby generates a straight motion path along the heading direction selected.
Reverse
Enable this to flip the direction of travel for the entire path. Toggle Reverse to correct an object traveling backwards.
Reverse flips the approach direction of the object and may have result in mirroring the path spatially.
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.
The heading is a direction along each axis, not a rotation value.
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.
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 and Positioning Mode selected.
Any channel that animates rotation may be used, either single attribute or combined.
Note that the selected input channel must be enabled and active to function.
As an example, Tween has been applied to Local Rotation Y to create a simple oscillating movement from -90 to 90 degrees.
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.
Flyby path generated from Tween rotation channel.
Any animation or behavior channel could potentially be used as rotation input.
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.
Use Time Offset to look ahead or lag behind the actual rotation of the object. This may be for subtle or accentuated for effect.
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.
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.
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.
Velocity Mode
Determines the speed of the object, affecting the overall distance the path covers.
Constant
Sets a fixed velocity maintained throughout the animation.
Use Constant velocity for trains and planes and other Flybys that don't need any variation in speed.
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.
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.
Enable Ease In Out for smooth quadratic interpolation, or disable it for linear interpolation.
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 or Velocity Channel.
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.
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 below.
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).
The velocity channel may have any number of keyframes and use of all keyframe/curve options.
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.
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.
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).
Click and drag the position handle to move the entire Flyby path, anchored at the Position.
Rotate Tool
Switch to the Rotate Tool to adjust the path 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.
Further Possibilities
With the power of simple keyframing and combining Flyby with other generative behaviors such as Tween, it's possible to create unlimited variations with complex results quickly and easily.
Using Tween to randomize rotation and looping Velocity curve to quickly create a complex path.
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.
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.
Using Multiple Flybys
Apply more than 1 Flyby to an object to create stack animations end to end or spaced out in time.
The channel order depends on the setting the Timeflow Preferences.