DOPath Method
DOPath(Rigidbody2D, Vector2[], float, PathType, PathMode, int, Color?)
public static TweenerCore<Vector3, Path, PathOptions> DOPath(this Rigidbody2D target, Vector2[] path, float duration, PathType pathType = null, PathMode pathMode = null, int resolution = 10, Color? gizmoColor = null)
Tweens a Rigidbody2D's position through the given path waypoints, using the chosen path algorithm. Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
NOTE: to tween a Rigidbody2D correctly it should be set to kinematic at least while being tweened.
BEWARE: doesn't work on Windows Phone store (waiting for Unity to fix their own bug). If you plan to publish there you should use a regular transform.DOPath.
Parameters
targetRigidbody2DpathVector2[]The waypoints to go through
durationfloatThe duration of the tween
pathTypePathTypeThe type of path: Linear (straight path), CatmullRom (curved CatmullRom path) or CubicBezier (curved with control points)
pathModePathModeThe path mode: 3D, side-scroller 2D, top-down 2D
resolutionintThe resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive. Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints
gizmoColorColor?The color of the path (shown when gizmos are active in the Play panel and the tween is running)
Returns
- TweenerCore<Vector3, Path, PathOptions>