UWorld::OverlapMultiByChannel
#include "Engine/World.h"
Access: public
Specifiers: const
Description
Tests a stationary collision shape at Pos against the world and returns all overlapping components on the given channel. Unlike sweep functions, the shape does not travel — it tests only at the given position.
Signature
bool OverlapMultiByChannel( TArray<struct FOverlapResult>& OutOverlaps, const FVector& Pos, const FQuat& Rot, ECollisionChannel TraceChannel, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam, const FCollisionResponseParams& ResponseParam = FCollisionResponseParams::DefaultResponseParam ) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OutOverlaps | TArray<struct FOverlapResult>& | Array filled with all components overlapping the shape at Pos. | — |
| Pos | const FVector& | World-space center of the collision shape. | — |
| Rot | const FQuat& | Rotation of the shape. | — |
| TraceChannel | ECollisionChannel | Collision channel determining which components are considered. | — |
| CollisionShape | const FCollisionShape& | The stationary shape to test overlaps for. | — |
| Params | const FCollisionQueryParams& | Additional query parameters. | FCollisionQueryParams::DefaultQueryParam |
| ResponseParam | const FCollisionResponseParams& | Override collision response settings. | FCollisionResponseParams::DefaultResponseParam |
Return Type
bool Caveats & Gotchas
- • Returns FOverlapResult objects, not FHitResult. FOverlapResult contains the component and actor but no impact point or normal — use a sweep if you need exact contact geometry.
- • The query can be expensive in dense areas. Consider filtering by object type with OverlapMultiByObjectType for more targeted queries.
- • bFindInitialOverlaps in FCollisionQueryParams (default true) controls whether components already touching the shape at Pos are included in results.
Example
Find all pawns within a radius C++
TArray<FOverlapResult> Overlaps;
FCollisionShape Sphere = FCollisionShape::MakeSphere(500.f);
FCollisionQueryParams Params;
Params.AddIgnoredActor(this);
GetWorld()->OverlapMultiByChannel(
Overlaps, GetActorLocation(), FQuat::Identity,
ECC_Pawn, Sphere, Params
);
for (const FOverlapResult& O : Overlaps)
{
AActor* A = O.GetActor();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?