RealDocs

UKismetSystemLibrary::BoxOverlapComponents

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

Description

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

Caveats & Gotchas

  • Forwards to BoxOverlapComponentsWithOrientation with FRotator::ZeroRotator — call that overload directly if you need a rotated box.
  • The Actors overload of this query names the same value BoxExtent while this one calls it Extent — same half-extent meaning despite the different parameter name.

Signature

static ENGINE_API bool BoxOverlapComponents(const UObject* WorldContextObject, const FVector BoxPos, FVector Extent, const TArray<TEnumAsByte<EObjectTypeQuery> > & ObjectTypes, UClass* ComponentClassFilter, const TArray<AActor*>& ActorsToIgnore, TArray<class UPrimitiveComponent*>& OutComponents)

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.
Extent 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.
ComponentClassFilter UClass* If set, only components of this class or subclasses are returned.
ActorsToIgnore const TArray<AActor*>& Actors whose components are excluded from the results.
OutComponents TArray<UPrimitiveComponent*>& Returned array of overlapping components. Unsorted.

Return Type

bool

Example

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

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

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.