RealDocs

UKismetSystemLibrary::BoxOverlapActors

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

Description

Finds every actor whose collision overlaps the given axis-aligned box.

Caveats & Gotchas

  • Just forwards to BoxOverlapActorsWithOrientation with FRotator::ZeroRotator, so the box is always axis-aligned in world space — call the WithOrientation overload directly if the box needs to be rotated.
  • BoxExtent is a half-extent, matching FCollisionShape::MakeBox — passing the full box size doubles the actual query volume.

Signature

static ENGINE_API bool BoxOverlapActors(const UObject* WorldContextObject, const FVector BoxPos, FVector BoxExtent, const TArray<TEnumAsByte<EObjectTypeQuery> > & ObjectTypes, UClass* ActorClassFilter, const TArray<AActor*>& ActorsToIgnore, TArray<class AActor*>& OutActors)

Parameters

Name Type Description Default
WorldContextObject const UObject* Object used to resolve which UWorld to run the query in.
BoxPos const FVector Center of the box in world space.
BoxExtent FVector Half-extents of the box (center-to-face distance on each axis).
ObjectTypes const TArray<TEnumAsByte<EObjectTypeQuery> >& Object Types (Project Settings > Collision) to restrict the query to.
ActorClassFilter UClass* If set, only actors of this class or subclasses are returned.
ActorsToIgnore const TArray<AActor*>& Actors excluded from the results.
OutActors TArray<AActor*>& Returned array of overlapping actors. Unsorted.

Return Type

bool

Example

Find overlapping actors in a box region C++
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldStatic));

TArray<AActor*> ActorsToIgnore;
TArray<AActor*> OverlappingActors;
UKismetSystemLibrary::BoxOverlapActors(this, GetActorLocation(), FVector(200.f, 200.f, 100.f), ObjectTypes, nullptr, ActorsToIgnore, OverlappingActors);

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.