Skip to content

@vaguevoid/fiasco / math/vector / moveTowards

Function: moveTowards()

moveTowards(current, target, delta): void

Defined in: src/math/vector.ts:55

Mutates the current vector towards the target vector by the delta amount.

Parameters

current

Vec2

The vector to mutate.

target

Vec2

The target vector to move towards.

delta

number

The amount to move in that direction.

Returns

void

Example

ts
moveTowards(enemy.position, player.position, consts.delta * ENEMY_SPEED)