RealDocs

UKismetSystemLibrary::ComponentOverlapActors

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

Description

Finds every actor whose collision overlaps Component's shape as if it were placed at ComponentTransform, without actually moving Component.

Caveats & Gotchas

  • Internally asserts check(Component->GetWorld()) before querying — Component must already be registered in a world (e.g. attached to a spawned, initialized actor); calling this with an unregistered or CDO component crashes.
  • Uses Component's own current collision shape and settings but the position/rotation from ComponentTransform, which is what makes it useful for 'can I fit here' checks without physically relocating the component first.

Signature

static ENGINE_API bool ComponentOverlapActors(UPrimitiveComponent* Component, const FTransform& ComponentTransform, const TArray<TEnumAsByte<EObjectTypeQuery> > & ObjectTypes, UClass* ActorClassFilter, const TArray<AActor*>& ActorsToIgnore, TArray<class AActor*>& OutActors)

Parameters

Name Type Description Default
Component UPrimitiveComponent* Component whose collision shape is used for the test.
ComponentTransform const FTransform& Where to place the component's shape for the overlap test.
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

Test whether a component's shape fits at a proposed location C++
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldStatic));

TArray<AActor*> ActorsToIgnore;
ActorsToIgnore.Add(GetOwner());

TArray<AActor*> OverlappingActors;
FTransform ProposedTransform(FRotator::ZeroRotator, TargetLocation);
UKismetSystemLibrary::ComponentOverlapActors(CollisionComponent, ProposedTransform, 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.