UKismetMathLibrary::Box_Overlap
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Returns the intersection (overlapping region) of two axis-aligned bounding boxes. Returns a zero-volume FBox when the boxes do not intersect rather than an invalid box.
Caveats & Gotchas
- • When the boxes do not overlap, the function returns an FBox with IsValid=true but zero or negative volume — it does **not** return an invalid FBox. Always check FBox::GetVolume() > 0 (or call Box_Intersects first) before using the result.
- • If the boxes only touch along a shared face or edge, the returned overlap box is degenerate (zero extent on the touching axis). Systems that compute volumes or sample points from the result may behave unexpectedly with degenerate inputs.
Signature
static ENGINE_API FBox Box_Overlap(const FBox& A, const FBox& B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FBox& | The first bounding box. | — |
| B | const FBox& | The second bounding box. | — |
Return Type
FBox Example
Find the shared region between two zone boxes C++
FBox ZoneA = GetZoneA();
FBox ZoneB = GetZoneB();
FBox Shared = UKismetMathLibrary::Box_Overlap(ZoneA, ZoneB);
if (Shared.GetVolume() > 0.f)
{
// Zones share a region — spawn content inside Shared
SpawnContentInBox(Shared);
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?