Line Trace won't stop on hit with wall

I’ve recently picked up UE4 and I’m learning quite a bit in a very short amount of time. However, I can’t seem to get my trace to stop upon hitting any sort of geometry in the world. I want it to only print a string if it hits another player in the game. Could someone help me? I can’t seem to find any threads or docs regarding this. Thanks :slight_smile:


(Apologies for spaghetti code :P)

Your trace is hitting geometry that have “Pawn” object type set to block in their collision settings

Maybe none of the objects you test had it ?

IF you don’t know much about collisions (kinda tricky to understand in unreal when you are new) i suggest you to check on the documentation that explains it really well ! :slight_smile:

There are multiple ways of doing it, but I assume you are aiming for some kind of first person multiplayer shooter.

What I would do (because line traces are very cheap performance wise) and this is an important mechanic in your game, run two traces. One for the pawn collision and one for the static collision (objects standing around). I recreated your blueprint graph partly and I red marked the things I added. With this setup you have more control, what you want to do, when a player is hit or what to do, if the ground or other objects are hit. You can use for example the second linetrace, which collides with other objects to run code for this specific case (aka hit effects, decals and such).
One mention though: If you use a linetrace, I would recommend using a branch node and connect the red “Return Value” node to the condition pin from the branch node. This will prevent your code being run, when it doesn’t need to.

Hope it helps :).

Thanks for the reply, but as said earlier, its a collision issue. I just want the raycast to stop upon hitting any object (and later apply an impact decal), and if it is a player, print a string (deal damage, but haven’t gotten there yet). I messed around a bit with it and still haven’t figured out how to pull this off. I’m attaching some amazing MSPaint examples of what is currently happening and what I want. Thanks for the help!
(I feel like im overcomplicating all this :P)


4382e78b091e4b1c956ed55b2e6fb93a.png

Old thred I know but did you try setting the trace channel in the line trace node to camera? I think it has to do with collision

@LAZYMAN 91 could u pls tell me how to do that?