UKismetMathLibrary::MapRangeClamped
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Linearly remaps Value from one range to another, clamping Value to [InRangeA, InRangeB] before mapping. The output is always within [OutRangeA, OutRangeB].
Caveats & Gotchas
- • Clamping is applied to the input before remapping, not to the output. If OutRangeA > OutRangeB (inverted output range) the output bounds are still respected but may appear swapped.
- • If InRangeA == InRangeB the function will divide by zero. Although the value is clamped first, a degenerate input range always causes division by zero regardless of Value.
Signature
static ENGINE_API double MapRangeClamped(double Value, double InRangeA, double InRangeB, double OutRangeA, double OutRangeB); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Value | double | The value to remap. | — |
| InRangeA | double | Start of the input range. | — |
| InRangeB | double | End of the input range. | — |
| OutRangeA | double | Start of the output range. | — |
| OutRangeB | double | End of the output range. | — |
Return Type
double Example
Map stamina percentage to a UI bar alpha C++
float Stamina = 0.4f;
double Alpha = UKismetMathLibrary::MapRangeClamped(Stamina, 0.0, 1.0, 0.2, 1.0); // returns 0.52 Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?