RealDocs

UKismetMathLibrary::GetMax2D

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns the larger of the vector's X and Y components, preserving sign. Use this when you need the dominant signed axis value.

Caveats & Gotchas

  • Returns the signed maximum, not the component with the largest magnitude. For a vector like (-100, 5), GetMax2D returns 5, not 100. Use GetAbsMax2D if you want the dominant magnitude.
  • Returns a scalar — you lose information about which axis held the maximum.

Signature

static UE_INL_API double GetMax2D(FVector2D A);

Parameters

Name Type Description Default
A FVector2D Input 2D vector.

Return Type

double

Example

Clamp the upper bound of a 2D speed vector component C++
FVector2D Speed = FVector2D(80.f, 95.f);
double MaxVal = UKismetMathLibrary::GetMax2D(Speed); // 95

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.