RealDocs

UWorld::ComponentSweepMulti

function Engine Since 4.0
#include "Engine/World.h"
Access: public Specifiers: const

Description

Sweeps a component's actual collision geometry from Start to End and returns all hit results. Unlike the SweepMultiBy* family, the shape is derived directly from PrimComp rather than a manually specified FCollisionShape — useful when you need exact geometry fidelity.

Caveats & Gotchas

  • PrimComp's world transform is entirely ignored — Start, End, and Rot define the pose used for the sweep. The component does not need to be positioned at Start.
  • A convenience FRotator overload exists but is an inline wrapper that converts to FQuat internally; prefer the FQuat signature to avoid the conversion cost.
  • PrimComp must have valid collision geometry and collision enabled. Components with collision disabled or no collision body will produce no hits.
  • The sweep uses PrimComp's own collision channel and response settings — it does not filter by a specific channel. Use ComponentSweepMultiByChannel to override the channel.

Signature

bool ComponentSweepMulti(TArray<struct FHitResult>& OutHits, class UPrimitiveComponent* PrimComp, const FVector& Start, const FVector& End, const FQuat& Rot, const FComponentQueryParams& Params) const

Parameters

Name Type Description Default
OutHits TArray<struct FHitResult>& Array populated with all hits found during the sweep.
PrimComp class UPrimitiveComponent* Component whose collision geometry is used for the sweep. Its world transform is ignored.
Start const FVector& World-space start location of the component geometry.
End const FVector& World-space end location of the component geometry.
Rot const FQuat& Rotation applied to the component geometry for the duration of the sweep.
Params const FComponentQueryParams& Additional query parameters such as actors or components to ignore.

Return Type

bool

Example

Sweep a character's capsule component to predict movement hits C++
UCapsuleComponent* Capsule = GetCapsuleComponent();
TArray<FHitResult> Hits;
FComponentQueryParams Params;
Params.AddIgnoredActor(this);

bool bBlocked = GetWorld()->ComponentSweepMulti(
    Hits,
    Capsule,
    GetActorLocation(),
    GetActorLocation() + Velocity * DeltaTime,
    GetActorQuat(),
    Params
);

for (const FHitResult& Hit : Hits)
{
    // respond to each hit
}

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.