UKismetMathLibrary::RandomPointInBoundingBox_Box
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a uniformly random point inside an FBox. Convenience overload of RandomPointInBoundingBox when you already have an FBox rather than a center and half-size pair.
Caveats & Gotchas
- • If the FBox is invalid (Min > Max on any axis), GetCenter() and GetExtent() return unexpected values and results will be wrong. Always ensure the box was constructed with valid bounds.
- • Not thread-safe (NotBlueprintThreadSafe); shares the same global FMath random state as all other non-stream random functions.
Signature
static UE_INL_API FVector RandomPointInBoundingBox_Box(const FBox Box); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Box | FBox | The bounding box to sample from. | — |
Return Type
FVector Example
Sample a random patrol point inside a nav bounds box C++
FBox NavBounds = NavVolume->GetBounds().GetBox();
FVector PatrolPoint = UKismetMathLibrary::RandomPointInBoundingBox_Box(NavBounds); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?