SteveDM
(SteveDM)
May 11, 2023, 9:14pm
1
I have a custom trace channel which is set to ignore by default and have created a C++ class with a static mesh component in it as follows:
MeshComp->SetCollisionResponseToChannel(ECC_EngineTraceChannel2, ECR_Block);
The problem is that when I created a BP class based off of this parent class, it remains as Ignore. I have to physically change the Collision Preset to Custom and then change the trace channel response to Block, and the response works fine with the line trace but I want this to happen by default.
Am I missing something here? Did I forget a step?
Where are you calling SetCollisionResponseToChannel() from?
Is the C++ class that you mention the base class of your BP?
How are you creating the Mesh Component?
Are collisions enabled?
This is how I usually do it in C++.
component->GetOwner()->SetActorEnableCollision(true);
component->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
component->SetCollisionObjectType(ObjectType);
component->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
component->SetCollisionResponseToChannel(ECC_Ground, ECollisionResponse::ECR_Block);
Beeeftub
(Beeeftub)
April 27, 2026, 2:51pm
3
In case anyone else runs into this, my problem was using ECC_EngineTraceChannel2 instead of ECC_GameTraceChannel2.
Try this instead:
MeshComp->SetCollisionResponseToChannel(ECC_GameTraceChannel2, ECR_Block);