Collision Response not overriding previous set value

I have created a capsule which I will use for single line tracing on only one channel and do not wish the main actor to be blocked by the capsule.

To do this I set the collision responses to:

CapsuleComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
CapsuleComponent->SetCollisionResponseToChannel(COLLISION_WEAPON, ECollisionResponse::ECR_Block);

In theory this would set all channels to ignore collisions and only the COLLISION_WEAPON channel (Engine Trace Channel 1) to be colliding with the object.

Unfortunately when I add the actor to the editor, all channels are ignored and the one I would like to be blocked is also ignored.

Any ideas of why this would be happening/solutions as I would prefer to define this in my objects constructor, rather than edit it for each object in the editor.

Don’t worry, I figured it out. I just created a custom Collision Profile and used:

CapsuleComponent->SetCollisionProfileName

to set the collision properties to that collision profile.

Hello,
could you give some more informations how you solved this?

Hi ,

In the constructor of the object you will define a component, as an example lets say that I have created a Sphere component which I only want to have events fire for the hit of custom Trace Channel.

I create it like so:

SphereOverlapComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereOverlapComponent"));

Then in the unreal engine under _______ you create a custom collision profile mine looks like this:

Then to have that component use that collision profile you define it like this:

SphereOverlapComponent->SetCollisionProfileName("UsableItemOverlap");

Hope that helps.