RealDocs

UKismetSystemLibrary::CapsuleOverlapComponents

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 capsule.

Caveats & Gotchas

  • Forwards to CapsuleOverlapComponentsWithOrientation with FRotator::ZeroRotator.
  • HalfHeight includes the hemisphere caps, matching FCollisionShape::MakeCapsule's convention.

Signature

static ENGINE_API bool CapsuleOverlapComponents(const UObject* WorldContextObject, const FVector CapsulePos, float Radius, float HalfHeight, 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.
CapsulePos const FVector Center of the capsule in world space.
Radius float Radius of the capsule's hemispheres and cylindrical section.
HalfHeight float Half-height of the capsule, from center to the tip of a hemisphere cap.
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 around a capsule C++
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldDynamic));

TArray<AActor*> ActorsToIgnore;
TArray<UPrimitiveComponent*> OverlappingComponents;
UKismetSystemLibrary::CapsuleOverlapComponents(this, GetActorLocation(), 34.f, 88.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.