Download

Custom trace channel not working

In my top down game I want to hit test for the ground only which is made up of hexes,and ignore props, trees, etc

I created a custom trace channel called “Mouse”, set default Ignore

Then checking my DefaultEngine.ini I see this, which seems correct:


+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,Name="Mouse",DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False)

In c++ this is the line that does the test:


PlayerController->GetHitResultUnderCursor(ECollisionChannel::ECC_GameTraceChannel1, true, HitResult);

I set collision on my hex mesh like so:
Capture.JPG

Problem: I get no hit result.

More interesting: If I use ECC_Camera, a default channel, it works. But I want to use a custom so I can set default to ignore and only modify the object that should block, the other way around means modifying a huge number of meshes.

Should this work? Anything I could be missing?

Figured it out. Will write solution in case anyone stumbles here.

I guess editor defaults aren’t enough, so I had to set collision at mesh component creation like this:


    MeshComponent->SetCollisionResponseToChannel(ECollisionChannel::ECC_GameTraceChannel1, ECollisionResponse::ECR_Block);

Run into the same problem. It actually works to set the collision to the actor from where you trace from. This makes 0 sense but thank god it worked, I have been stucked all day in this thing. (Actually, If you want multiple hits have to set it to overlap as in my case)