UKismetMathLibrary::Box_ExpandBy
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Returns a new FBox grown (or shrunk) by independent amounts on the negative and positive sides of each axis. Useful for adding asymmetric margins around a bounding box, such as a larger buffer on the forward side of an AI agent.
Caveats & Gotchas
- • Positive values in the Negative parameter move the Min corner in the **negative** world direction (i.e. outward from the box). The naming is counterintuitive: think of it as 'how much to push the negative face outward', not a signed offset.
- • Passing a negative shrink amount that exceeds the box's current half-extent will cause Min to exceed Max on that axis. The engine does not clamp this; the resulting FBox is mathematically invalid even though IsValid remains true.
Signature
static ENGINE_API FBox Box_ExpandBy(const FBox& Box, const FVector& Negative, const FVector& Positive); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Box | const FBox& | The source bounding box to expand. | — |
| Negative | const FVector& | Amount to move the Min corner outward (positive values expand, negative values shrink). | — |
| Positive | const FVector& | Amount to move the Max corner outward (positive values expand, negative values shrink). | — |
Return Type
FBox Example
Add a uniform 50-unit safety margin around an actor's bounds C++
FBox ActorBounds = MyActor->GetComponentsBoundingBox();
FVector Margin(50.f, 50.f, 50.f);
FBox SafetyBounds = UKismetMathLibrary::Box_ExpandBy(ActorBounds, Margin, Margin); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?