UKismetSystemLibrary::CapsuleOverlapActors
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Finds every actor whose collision overlaps the given axis-aligned capsule.
Caveats & Gotchas
- • Forwards to CapsuleOverlapActorsWithOrientation with FRotator::ZeroRotator.
- • HalfHeight is measured from the capsule's center to the tip of a hemisphere cap (per the header comment), not the half-height of just the cylindrical section — it already includes the caps.
Signature
static ENGINE_API bool CapsuleOverlapActors(const UObject* WorldContextObject, const FVector CapsulePos, float Radius, float HalfHeight, 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. | — |
| 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
Find overlapping actors around a capsule C++
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECC_Pawn));
TArray<AActor*> ActorsToIgnore;
ActorsToIgnore.Add(this);
TArray<AActor*> OverlappingActors;
UKismetSystemLibrary::CapsuleOverlapActors(this, GetActorLocation(), 34.f, 88.f, ObjectTypes, nullptr, ActorsToIgnore, OverlappingActors); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?