Table of Contents

DOJump Method

Namespace
DG.Tweening

DOJump(Rigidbody2D, Vector2, float, int, float, bool)

public static Sequence DOJump(this Rigidbody2D target, Vector2 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)

Tweens a Rigidbody2D'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 Rigidbody2D as the tween's target so it can be used for filtered operations.

IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set the position

Parameters

target Rigidbody2D
endValue Vector2

The end value to reach

jumpPower float

Power of the jump (the max height of the jump is represented by this plus the final Y offset)

numJumps int

Total number of jumps

duration float

The duration of the tween

snapping bool

If TRUE the tween will smoothly snap all values to integers

Returns

Sequence