Api > Vector3 > MoveTowards()
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:
Name |
Type |
Description |
current |
Vector3 |
The position to move from. |
target |
Vector3 |
The position to move towards. |
maxDistanceDelta |
number |
Distance to move current per call. |
Returns:
type |
Description |
Vector3 |
The new position. |
Usage
---@type Vector3
local current;
---@type Vector3
local target;
---@type number
local maxDistanceDelta;
local val0 = Vector3:MoveTowards(current, target, maxDistanceDelta)