RealDocs

UGameplayStatics::GetActorArrayBounds

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

Description

Computes the combined axis-aligned bounding box of an array of actors, returning the box centre and half-extents. Optionally considers only components that have collision enabled.

Caveats & Gotchas

  • If the array is empty, Center and BoxExtent are both set to FVector::ZeroVector — callers must check array size before using the outputs for any spatial logic.
  • bOnlyCollidingComponents=true can produce a much tighter or even degenerate box if actors have skeletal meshes with collision disabled; verify component collision settings before relying on this flag.

Signature

static ENGINE_API void GetActorArrayBounds(const TArray<AActor*>& Actors, bool bOnlyCollidingComponents, FVector& Center, FVector& BoxExtent);

Parameters

Name Type Description Default
Actors const TArray<AActor*>& Array of actors to compute the combined bounds for.
bOnlyCollidingComponents bool If true, only components with collision enabled contribute to the bounds.
Center FVector& Output: the world-space centre of the combined bounding box.
BoxExtent FVector& Output: the half-extent of the combined bounding box along each axis.

Return Type

void

Example

Fit a camera to frame a group of selected actors C++
TArray<AActor*> Selected = GetSelectedActors(); // your selection
FVector Center, Extent;
UGameplayStatics::GetActorArrayBounds(Selected, false, Center, Extent);
float Radius = Extent.Size();
// Use Center + Radius to position a framing camera

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.