AActor::GetComponentsCollisionResponseToChannel
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualconst
Description
Returns the most restrictive collision response across all components for the given channel. If any component blocks the channel the result is ECR_Block; if any overlaps (and none block) the result is ECR_Overlap; otherwise ECR_Ignore.
Caveats & Gotchas
- • The result is the maximum response across all components — a single blocking primitive makes the whole actor appear to block even if every other component ignores that channel.
- • Components with collision disabled (ECollisionEnabled::NoCollision) contribute ECR_Ignore and will never raise the actor-level response on their own.
- • This function iterates all owned components and should not be called every tick on actors with large component counts.
Signature
virtual ECollisionResponse GetComponentsCollisionResponseToChannel(ECollisionChannel Channel) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Channel | ECollisionChannel | The collision channel to query. | — |
Return Type
ECollisionResponse Example
Check whether an actor blocks the Pawn channel C++
ECollisionResponse Response = MyActor->GetComponentsCollisionResponseToChannel(ECC_Pawn);
if (Response == ECR_Block)
{
UE_LOG(LogTemp, Log, TEXT("Actor blocks pawns"));
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?