Skip to content

vec2MoveToward

vec2MoveToward(current, target, delta): Vec2

Defined in: src/modules/math/vec2.ts:40

current stepped delta units along the straight line to target; sibling of vec3MoveToward. A forward mover cannot overshoot: once the remaining distance is within delta the target itself is returned, so repeated calls settle on it instead of oscillating around it.

delta is a signed step: a negative one walks away from the target, and 0 leaves the position unchanged.

Vec2

Vec2

number

Vec2