RealDocs

UKismetSystemLibrary::CapsuleOverlapActorsWithOrientation

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

Description

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

Caveats & Gotchas

  • • HalfHeight includes the hemisphere caps, not just the cylindrical mid-section.
  • • The header's own doc comment for Orientation says 'Orientation of the box' — a leftover copy-paste from the Box overload; the parameter is in fact the capsule's rotation.

Signature

static ENGINE_API bool CapsuleOverlapActorsWithOrientation(const UObject* WorldContextObject, const FVector CapsulePos, float Radius, float HalfHeight, FRotator Orientation, 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. —
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. —
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

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

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