Class DOTweenModulePhysics
Namespace: DG.Tweening
Syntax
public static class DOTweenModulePhysics
Methods
DOJump(Rigidbody, Vector3, Single, Int32, Single, Boolean)
Tweens a Rigidbody's position to the given value, while also applying a jump effect along the Y axis. Returns a Sequence instead of a Tweener. Also stores the Rigidbody as the tween's target so it can be used for filtered operations
Declaration
public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Vector3 | endValue | The end value to reach |
Single | jumpPower | Power of the jump (the max height of the jump is represented by this plus the final Y offset) |
Int32 | numJumps | Total number of jumps |
Single | duration | The duration of the tween |
Boolean | snapping | If TRUE the tween will smoothly snap all values to integers |
Returns
Type | Description |
---|---|
Sequence |
DOLocalPath(Rigidbody, Vector3[], Single, PathType, PathMode, Int32, Nullable<Color>)
Tweens a Rigidbody's localPosition through the given path waypoints, using the chosen path algorithm. Also stores the Rigidbody as the tween's target so it can be used for filtered operations
NOTE: to tween a rigidbody 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.DOLocalPath.
Declaration
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(this Rigidbody target, Vector3[] path, float duration, PathType pathType = null, PathMode pathMode = null, int resolution = 10, Color? gizmoColor = default(Color? ))
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Vector3[] | path | The waypoint to go through |
Single | duration | The duration of the tween |
PathType | pathType | The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) |
PathMode | pathMode | The path mode: 3D, side-scroller 2D, top-down 2D |
Int32 | resolution | The resolution of the path: 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 |
Nullable<Color> | gizmoColor | The color of the path (shown when gizmos are active in the Play panel and the tween is running) |
Returns
Type | Description |
---|---|
TweenerCore<Vector3, Path, PathOptions> |
DOLookAt(Rigidbody, Vector3, Single, AxisConstraint, Nullable<Vector3>)
Tweens a Rigidbody's rotation so that it will look towards the given position. Also stores the rigidbody as the tween's target so it can be used for filtered operations
Declaration
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = null, Vector3? up = default(Vector3? ))
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Vector3 | towards | The position to look at |
Single | duration | The duration of the tween |
AxisConstraint | axisConstraint | Eventual axis constraint for the rotation |
Nullable<Vector3> | up | The vector that defines in which direction up is (default: Vector3.up) |
Returns
Type | Description |
---|---|
TweenerCore<Quaternion, Vector3, QuaternionOptions> |
DOMove(Rigidbody, Vector3, Single, Boolean)
Tweens a Rigidbody's position to the given value. Also stores the rigidbody as the tween's target so it can be used for filtered operations
Declaration
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Vector3 | endValue | The end value to reach |
Single | duration | The duration of the tween |
Boolean | snapping | If TRUE the tween will smoothly snap all values to integers |
Returns
Type | Description |
---|---|
TweenerCore<Vector3, Vector3, VectorOptions> |
DOMoveX(Rigidbody, Single, Single, Boolean)
Tweens a Rigidbody's X position to the given value. Also stores the rigidbody as the tween's target so it can be used for filtered operations
Declaration
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Single | endValue | The end value to reach |
Single | duration | The duration of the tween |
Boolean | snapping | If TRUE the tween will smoothly snap all values to integers |
Returns
Type | Description |
---|---|
TweenerCore<Vector3, Vector3, VectorOptions> |
DOMoveY(Rigidbody, Single, Single, Boolean)
Tweens a Rigidbody's Y position to the given value. Also stores the rigidbody as the tween's target so it can be used for filtered operations
Declaration
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Single | endValue | The end value to reach |
Single | duration | The duration of the tween |
Boolean | snapping | If TRUE the tween will smoothly snap all values to integers |
Returns
Type | Description |
---|---|
TweenerCore<Vector3, Vector3, VectorOptions> |
DOMoveZ(Rigidbody, Single, Single, Boolean)
Tweens a Rigidbody's Z position to the given value. Also stores the rigidbody as the tween's target so it can be used for filtered operations
Declaration
public static TweenerCore<Vector3, Vector3, VectorOptions> DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Single | endValue | The end value to reach |
Single | duration | The duration of the tween |
Boolean | snapping | If TRUE the tween will smoothly snap all values to integers |
Returns
Type | Description |
---|---|
TweenerCore<Vector3, Vector3, VectorOptions> |
DOPath(Rigidbody, Vector3[], Single, PathType, PathMode, Int32, Nullable<Color>)
Tweens a Rigidbody's position through the given path waypoints, using the chosen path algorithm. Also stores the Rigidbody as the tween's target so it can be used for filtered operations.
NOTE: to tween a rigidbody 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.
Declaration
public static TweenerCore<Vector3, Path, PathOptions> DOPath(this Rigidbody target, Vector3[] path, float duration, PathType pathType = null, PathMode pathMode = null, int resolution = 10, Color? gizmoColor = default(Color? ))
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Vector3[] | path | The waypoints to go through |
Single | duration | The duration of the tween |
PathType | pathType | The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path) |
PathMode | pathMode | The path mode: 3D, side-scroller 2D, top-down 2D |
Int32 | resolution | The 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 |
Nullable<Color> | gizmoColor | The color of the path (shown when gizmos are active in the Play panel and the tween is running) |
Returns
Type | Description |
---|---|
TweenerCore<Vector3, Path, PathOptions> |
DORotate(Rigidbody, Vector3, Single, RotateMode)
Tweens a Rigidbody's rotation to the given value. Also stores the rigidbody as the tween's target so it can be used for filtered operations
Declaration
public static TweenerCore<Quaternion, Vector3, QuaternionOptions> DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = null)
Parameters
Type | Name | Description |
---|---|---|
Rigidbody | target | |
Vector3 | endValue | The end value to reach |
Single | duration | The duration of the tween |
RotateMode | mode | Rotation mode |
Returns
Type | Description |
---|---|
TweenerCore<Quaternion, Vector3, QuaternionOptions> |