Why is line trace not hitting my pawn?

Hi guys,

I cannot get a Line trace by channel to hit my player pawn. It just goes straight through. I have another project where the trace does work. The defaults for the character mesh and capsule component in the collision section are the same which leads me to think that it’s possible to change the collision effects somewhere else.

Does anyone have a clue as to what I should do?

For good measure, I have attached a screen of the collision section in the default tab of the character blueprint.

You have collision with trace visibility set to ignore and telling it to trace on the visibility channel. You’ll need to change one thing or the other.

2 Likes

Maybe these screens will provide some more clarification.I don’t know what I’m missing.

Thank you Furroy.

Yes, on the capsule, but the not on the mesh. Trace should hit the mesh. Also, have just quadruple checked the default for the working project (The one where the trace hits) and it’s exactly the same. So it must be something else.

Anyone has other ideas?

1 Like

I have the exact same problem

KennethMundt,

I was going to give a [mild explanation on setting up Collision Filtering][1], since I had the same thing. I also did not get it 100% accurate, but just tested that if you set the inherited Capsule component to BlockAll instead of its default of Pawn, you’ll get the following (The trace starts on the right and goes to the left; Note that the black character is not blocking the visibility channel and therefore the lines technically went threw him when I ‘drew’ the traces).

44746-char.png


If you do not want it blocking the visibility channel, you may want to setup your own trace channel or object collision channel in the Edit >> Project Settings and then set the collision in each Blueprint component choose “Custom” and set your ignore/overlap/block checkboxes however you will it. I tried this and it appears that the capsule still overrules my Custom collision settings no matter which way.

I suspect you are like me though and searching for when it hits exactly on the animated mesh itself.

References:
This will help explain collision filtering to anyone else: Collision Filtering - Unreal Engine

Best,
SmashRash

2 Likes

Add corresponding physics asset under physics panel of your character mesh. I had the same problem and add a physics asset from the animation pack and the line trace works on my character.

1 Like

I used LineTraceForObjects. Then from the Object Types pin drag out to Make Array. Then on the array you can select Pawn from the drop down. You can also add additional pins to the array for additional object types using the same trace.

Same problem, I am using component trace but it does not give the physical material hit which is what I need… is there any way around this?

Thank you man for this info, was helpful for me!

At 4:25 am this can be problem :slight_smile: Thx

Worked for me too. Great thx :3

Answering the original question: the mesh’s collision won’t matter as it’s the root component (Capsule in a Character’s case) that counts. So it doesn’t matter what the underlying skeletal mesh is to block - it won’t ever block anything. The other thing you could do is change the Pawn collision Profile’s trace response to block the Visibility channel, see the screenshot below (project settings → Engine → Collision).

1 Like

Thanks GlassBeaver. Changing Trace Type Visibility solved the issue for me.

That’s what I was looking for! :slight_smile:

Hi, I set up line trace by channel from MyCharacter to 1000 units forward and trying to detect hit on my AI, I set up Capsule Componet from AI to Collision Custom with enabling Visibility block but at stil won’t detect hit on AI. Can someone help?

In case someone still struggling with this in 2023: Just set Trace Channel to Camera :sweat_smile:

1 Like