RealDocs

UKismetMathLibrary::MakeBox2D

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

Description

Constructs a 2D axis-aligned bounding box from explicit Min and Max corners and sets IsValid to true. Commonly used for UI hit-testing, screen-space culling, or 2D map region checks.

Caveats & Gotchas

  • Min and Max are not validated or sorted — if Max.X < Min.X or Max.Y < Min.Y on any axis, the box is malformed. Use FBox2D::operator+= with individual points to let the engine build a valid box from an arbitrary point set.
  • FBox2D uses double-precision FVector2D in UE5. Mixing it with legacy float-precision 2D math can introduce subtle precision drift in screen-space or map-coordinate calculations.

Signature

static UE_INL_API FBox2D MakeBox2D(FVector2D Min, FVector2D Max);

Parameters

Name Type Description Default
Min FVector2D The minimum corner of the 2D box.
Max FVector2D The maximum corner of the 2D box.

Return Type

FBox2D

Example

Define a minimap region for HUD rendering C++
FVector2D TopLeft(0.f, 0.f);
FVector2D BottomRight(256.f, 256.f);
FBox2D MinimapBox = UKismetMathLibrary::MakeBox2D(TopLeft, BottomRight);
// MinimapBox.IsInside(ScreenPos) can now be used to clamp icon positions

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.