With this function you can maintain an input value between a specified range.
clamp(val, min, max)
| Argument | Type | Description |
|---|---|---|
| val | Real | The value to clamp. |
| min | Real | The minimum value to clamp between. |
| max | Real | The maximum value to clamp between. |
speed = clamp(speed, 1, 10);
The above code will clamp the speed so that it never falls below 1 or goes over 10.