UKismetMathLibrary::Box_IsInsideOrOn
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Returns true when InnerTest is completely inside OuterTest, including cases where the inner box shares a face, edge, or corner with the outer boundary. Use this variant when boundary contact should count as containment.
Caveats & Gotchas
- • When InnerTest and OuterTest are exactly equal, this returns true (the box contains itself), whereas Box_IsInside returns false for the same inputs. Be deliberate about which semantic you need.
- • Like Box_IsInside, both boxes must have IsValid=true — passing an uninitialized FBox produces undefined results with no runtime error.
Signature
static ENGINE_API bool Box_IsInsideOrOn(const FBox& InnerTest, const FBox& OuterTest); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InnerTest | const FBox& | The box to test for containment. | — |
| OuterTest | const FBox& | The candidate containing box. | — |
Return Type
bool Example
Validate that a spawnable area fits within a map boundary C++
FBox MapBounds = GetMapBoundingBox();
FBox SpawnArea = GetSpawnRegionBox();
if (!UKismetMathLibrary::Box_IsInsideOrOn(SpawnArea, MapBounds))
{
UE_LOG(LogGame, Warning, TEXT("Spawn region extends outside map bounds!"));
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?