RealDocs

UKismetMathLibrary::Vector_ComponentMax

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

Description

Returns a vector whose each component is the maximum of the corresponding components from A and B: (max(A.X,B.X), max(A.Y,B.Y), max(A.Z,B.Z)). Used together with Vector_ComponentMin to construct axis-aligned bounding boxes.

Caveats & Gotchas

  • This is component-wise, not a magnitude comparison. A component-max vector may point in a completely different direction than either input.
  • Pair with Vector_ComponentMin to build an AABB from an arbitrary set of points by folding over the set.
  • Equivalent to FVector::ComponentMax on the FVector type directly.

Signature

static UE_INL_API FVector Vector_ComponentMax(FVector A, FVector B);

Parameters

Name Type Description Default
A FVector First vector.
B FVector Second vector.

Return Type

FVector

Example

Build an AABB from two corner points C++
FVector CornerA = FVector(10.f, -5.f, 100.f);
FVector CornerB = FVector(-20.f, 30.f, 50.f);
FVector BoxMin = UKismetMathLibrary::Vector_ComponentMin(CornerA, CornerB);
FVector BoxMax = UKismetMathLibrary::Vector_ComponentMax(CornerA, CornerB);
// BoxMin = (-20, -5, 50), BoxMax = (10, 30, 100)

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.