UKismetMathLibrary::GetAbsMax2D
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns the largest absolute value among the vector's X and Y components. Useful for determining the dominant axis regardless of sign.
Caveats & Gotchas
- • Returns a scalar, not a vector — it does not tell you which component was dominant. Use GetMax2D if you need the signed maximum.
- • On a zero vector the result is 0.0, which is well-defined but may need guarding if you intend to divide by this value.
Signature
static UE_INL_API double GetAbsMax2D(FVector2D A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector2D | Input 2D vector. | — |
Return Type
double Example
Scale a velocity so its dominant axis stays within a limit C++
FVector2D Velocity = FVector2D(-120.f, 45.f);
double MaxComponent = UKismetMathLibrary::GetAbsMax2D(Velocity); // 120
if (MaxComponent > 100.0)
Velocity *= 100.0 / MaxComponent; Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?