Mathf.MoveTowards(number current, number target, number maxDelta)
Moves a value current towards target.
Parameters:
Name | Type | Description |
---|---|---|
current | number | The current value. |
target | number | The value to move towards. |
maxDelta | number | The maximum change that should be applied to the value. |
Returns:
type | Description |
---|---|
number | Moved value current towards target. |
Usage
---@type number
local current;
---@type number
local target;
---@type number
local maxDelta;
local val0 = Mathf:MoveTowards(current, target, maxDelta)
Extra Detail
This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta. Negative values of maxDelta pushes the value away from target.