đPlace On Path
Place an object on a motion path
This behavior places an object on a motion path, which may be used both as an editing feature when constructing scenes and to animate objects along or relative to a path.
Place On Path has 2 read-only channels outputting the final placed position and rotation.
Place On Path Editor
Select the object to view its settings in the Inspector.
For common features, please refer to Menu Bar and Update Settings.
Every Frame vs Explicit Update
By default, Place On Path updates every frame, however this may be changed in the Update Settings.
To animate Place On Path make sure Every Frame is selected. Otherwise use Explicit mode to only update when refreshed.
Refresh All
After making changes to a motion path, use Refresh All to update all instances of Place On Path to recalculate their placements relative to the path.
Motion Path
Assign the Motion Path to use for placement. When the behavior is first applied it automatically locates the first Motion Path instance. This can be assigned manually by dragging and dropping a game object from the Hierarchy view.
Flyby Path
Select this mode to place an object on a Flyby path. The settings works the same as with a motion path.
Path Provider (Unity Spline)
A Path Provider is a type of component which implements custom path interpolation. When using the Splines package in Unity, this offers the ability to interpolate spline paths.
To setup a spline for use with Place On Path, add the Spline Path Provider script to the Spline Container. This can then be assigned as the Path Provider as shown above.
Be sure that your Spline Container and Place On Path are on different game objects.
For an example, see the scene:
Samples/Scenes/Automation/PlaceOnPath_UnitySpline
For more information see Unity Splines
Relative To
Placement may use the full path, follow the current path time, or start from a specific node.
Full Path
This is the default mode and interpolates along the entire path.
Current Time On Path
Placement is based on the current position of the motion path at the current time.
Use this mode to place objects on the motion path at the current time. If Every Frame is enabled, this animates the object along the path matching the original motion. Position and time offsets may both be used to offset the placement in time.
Node On Path
This mode places the object relative to a specific keyframe node along the path, maintaining its relative relationship even when the path has been modified or new keyframes added.
To use this feature, enable Expose Nodes on the Motion Path so that the path node objects are visible in the scene hierarchy (path nodes are game objects, initially hidden from the hierarchy view). To assign a node, drag and drop the game object into the MotionPathNode field above.
This is a useful method to keep objects aligned to a motion path while still being able to make changes to it. It can also be helpful to animate an object starting from a specific keyframe in the path.
Position & Time
Placement along the path is determined by both Position and Time. Both or either may be used to adjust placement.
Position: Interpolates along the path from start to end (normalized from 0 to 1).
Time: Applies an offset in seconds based on the path timing as it is animated in Timeflow.
Unless using Full Path, both Position and Time act as offsets (relative to the current time or node position).
Animating an object along a path using Position (animating from 0 to 1) allows objects to have their own independent velocity over the length of the path. Whereas using Time is relative to the motion path timing including velocity changes.
Wrap
If enabled, interpolation wraps the start and end of the path in an endless loop, with no limits enforced on Position allowing endless interpolation (looping in cycles over the path). This works with any path regardless of whether the start and end points meet in 3D space.
Use Wrap for objects that traverse a path multiple times or for closed paths to interpolate continuously where the start and end meet.
Goto / Get Current Time
These buttons are shortcuts to help with editing. Press Goto to jump to the set time in Timeflow. And press Get Current Time to assign the current time (from the playhead position in Timeflow) to the field.
World Coordinates
Enable to match the motion path placement in world space, otherwise local space is used.
This is only relevant when the motion path (or the current object being placed) has differences in hierarchical offset and/or scale.
Using local coordinates, parent transforms may be used to replicate a path at a different scale and position. For example, this could be used to create a minified map in a HUD displaying the relative position of an object on a full scale path.
Lock Position / Rotation
Each axis of position and rotation may optionally be locked to constrain placement on certain axes or a plane.
When locked, the field appears darkened but is not disabled and can still be manually edited. Set these values to the desired placement position.
Offset Position
Applies a positional offset to the final placement of the object.
Offset Position is applied after Lock Position, so it can still be used to adjust placement. This value may also be animated or driven by other behaviors to move an object relative to its placement on the path.
After Rotation
This option determines whether the positional offset is applied before or after the rotation is applied, which affects the final placement.
Position Smooth
Applies temporal smoothing defined in seconds to the placed position. This may be used to smooth out bumps in the motion, however larger values can be used to create lazy following effects. The larger the smoothing value, the more the object may drift off of the path.
Rotation Mode
Selects the mode for calculating rotation.
None: Does not calculate rotation and only applies the Orientation value.
Interpolate: Matches the path's rotation over time.
Look Ahead: Calculates rotation by looking at the path ahead (in seconds)
Look At: Dynamically faces towards the specified object
Apply to Object
When using the Look Ahead mode, the look ahead point may be applied to the position of the specified game object. This can be helpful to visualize the look at point, or as additional animation feature.
Orientation
Applies rotational offset to the object.
Orientation applies a final offset to the object rotation, taking into account Auto Rotate modes. This value may also be animated to layer additional rotation movement.
Smooth Time
Applies temporal smoothing to the overall placement. Set to 0 to disable.
When Smooth Time is in use, the object's movement is smoothed over time and space. This usually results in the object meandering off the path as it tries to catch up with the target position.
Use Smooth Time for floating objects that don't require staying fixed to the path.
Additional Notes
Scene Construction and Prototyping
Place On Path is a useful tool when constructing scenes. It makes it easy to place objects along a hero or main camera path. If placements are related to specific path nodes, then those nodes can be moved in space and time and the placed objects updated to the new position.
During the prototyping stage of an animation, this is particularly helpful to make changes to the path, such as inserting more time or covering more distance, and being able to quickly update all associated object placements, rather than having to reposition each one by hand.
Explicit Update
If you wish to prevent placed objects from updating automatically, use Explicit mode in the Update Settings. When set, Place On Path only updates placement when the Refresh (or Refresh All) button is pressed.
Editor Only Instances
When using Place On Path for scene building, the run mode may be changed to Editor Only so that the component is automatically removed at runtime, helping to optimize performance while still preserving the setup for use in edit mode. This happens during OnAwake upon entering play mode or upon loading a scene at runtime.
Last updated