mathClamp

Restricts a value to a specified range. Takes value (number to constrain), min (minimum allowed value), max (maximum allowed value). Returns the value constrained to be between min and max (inclusive).

Mathematics

Parameters & Returns

Parameters

value Double
min Double
max Double

Returns

Double

Quick Summary

Restricts a value to a specified range. Takes value (number to constrain), min (minimum allowed value), max (maximum allowed value). Returns the value constrained to be between min and max (inclusive).

Technical Exegesis...

Constrains value to be between min and max (inclusive). If value is less than min, returns min. If value is greater than max, returns max. Otherwise returns value unchanged.

Commonly used for limiting player movement, UI bounds, or ensuring values stay within valid ranges.

Example

Example.bam
; No example implemented yet