Skip to main content

Vector3.MoveTowards(Vector3 current, Vector3 target, number maxDistanceDelta)

Calculate a position between the points specified by current and target, moving no farther than the distance specified by maxDistanceDelta.

Parameters:

NameTypeDescription
currentVector3The position to move from.
targetVector3The position to move towards.
maxDistanceDeltanumberDistance to move current per call.

Returns:

typeDescription
Vector3The new position.

Usage

---@type Vector3
local current;

---@type Vector3
local target;

---@type number
local maxDistanceDelta;


local val0 = Vector3:MoveTowards(current, target, maxDistanceDelta)