UPrimitiveComponent::SetCollisionResponseToChannel
#include "Components/PrimitiveComponent.h"
Access: public
Specifiers: virtual
Description
Sets this component's response to a single collision channel. Overrides the current profile response for that channel only.
Signature
virtual void SetCollisionResponseToChannel(ECollisionChannel Channel, ECollisionResponse NewResponse) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Channel | ECollisionChannel | The channel to set the response for (e.g. ECC_WorldStatic, ECC_Pawn). | — |
| NewResponse | ECollisionResponse | ECR_Ignore, ECR_Overlap, or ECR_Block. | — |
Return Type
void Caveats & Gotchas
- • Calling this switches the component off any named collision profile. The component's profile name will no longer accurately describe its actual responses.
- • Collision is bidirectional — both components must have compatible responses for an interaction to occur. If this component blocks ECC_Pawn but a pawn ignores ECC_WorldDynamic, no block occurs.
- • For broad reconfiguration, use SetCollisionProfileName instead — it sets all channels at once from a defined preset.
Example
Make a trigger ignore pawns but overlap with projectiles C++
TriggerBox->SetCollisionResponseToAllChannels(ECR_Ignore);
TriggerBox->SetCollisionResponseToChannel(ECC_GameTraceChannel1, ECR_Overlap); // Projectile channel
TriggerBox->SetCollisionEnabled(ECollisionEnabled::QueryOnly); See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?