RealDocs

UKismetSystemLibrary::CapsuleOverlapComponentsWithOrientation

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

Description

Finds every primitive component whose collision overlaps the given capsule at an arbitrary world-space orientation.

Caveats & Gotchas

  • HalfHeight includes the hemisphere caps, not just the cylindrical section.
  • Like the other WithOrientation overlap functions, ComponentClassFilter only filters the returned array after the underlying query has already run against every ObjectTypes channel — it doesn't reduce the cost of the query itself.

Signature

static ENGINE_API bool CapsuleOverlapComponentsWithOrientation(const UObject* WorldContextObject, const FVector CapsulePos, float Radius, float HalfHeight, FRotator Orientation, 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.
Orientation FRotator World-space rotation of the capsule.
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

Query a tilted capsule for components C++
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_WorldDynamic));

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