-
Notifications
You must be signed in to change notification settings - Fork 1
Paths
Namespace: WIDVE.Paths
Location: WIDVE Unity Scripts/Paths
The scripts in the Paths folder are designed for use with the PathCreator and TubeRenderer assets. The Paths scripts exist in their own assembly definition file, and will be included in the project only if the WIDVE_PATHS define constraint is set.
The PathEvent component holds a UnityEvent associated with a PathPosition. When used with a PathTrigger, the event can be invoked when the trigger reaches the specified position.
The PathInterpolator component serves as a way to control an Interpolator's value based on an object's position along a path. When used in combination with the PathInterpolatorBounds component, it sets the Interpolator's value based on a PathPosition's position between the Start and End path positions. The value will be 0 when the object is at Start, 1 when it is at End, and an interpolated value when it is in between. In the Paths/Prefabs folder, there is a PathInterpolator prefab that contains everything the PathInterpolator needs to work.
The Pathmovement component moves an object along a path in response to button input. It is designed to use a thumbstick or other two-dimensional input device.
| Property | Description |
|---|---|
MovementButton |
A ButtonVector2. The Y-axis input is used to move forwards or backwards along the path. |
Position |
The PathPosition component that will be moved. |
Speed |
Controls the speed at which the object moves along the path. |
The PathObjectSequence components holds a sorted list of all objects placed on a path. It can be used to access and iterate over all objects on a path. It is updated automatically when new objects are placed on the path or removed from the path.
The PathObserver component extends the Observercomponent. It notifies other components when its associated path has been modified.
The PathPosition component is used to place an object on a path. It overrides the object's Transform and instead locks the object's position and rotation to a point along the path. The position along the path can be changed in the editor and through script.
| Property | Description |
|---|---|
Path |
The path this object will be placed on. |
Position |
Position along the path, from 0 (start) to 1 (end). |
Distance |
Distance along the path. Returns the current Position value converted into meters (in local scale). |
LockWorldPosition |
When checked, the object's world position will attempt to stay locked. If the path is modified, the object's Position value will change to stay as close as possible to its original world position. When unchecked, the object's world position will change to reflect it's current Position value on the modified path. |
Rotate |
The Rotate checkboxes specify whether the object's rotation should match the path's direction. Rotation in X, Y, and Z can be enabled separately. |
The PathToTube component is used to control a TubeRenderer from a PathCreator component. When it is given both a path and a tube, it sets the tube mesh to match the path's spline. It will automatically update the tube when the path is modified.
The PathTrigger component is used to activate PathEvents as it travels along a path. It uses the PathObjectSequence and its own PathPosition to trigger any events it passes as its path position changes. It also includes a LayerMask; PathEvents that are not on the specified layers will be ignored.