Line Trace By Channel help?

For several months I’ve been trying to create a way to take out enemies by jumping on them, a la Super Mario, but to no avail. My first attempt at was to attach a collision box to the underside of my character’s model that would handle all of the collision events with the enemy. Unfortunately though, it turned out that the events of the collision box would frequently be unable to respond fast enough to prevent the character’s capsule component from contacting the enemy, resulting in the player occasionally taking damage from jumping on the enemy.

So my second idea was to instead scrap the collision box in favor of Line Tracing based on tutorial Link] I found on YouTube.

The idea would be that when the line trace detects contact between the player and enemy, the damage collision from the enemy would be disabled as long the player is making contact with the enemy. When the player isn’t in contact with the enemy then the enemy’s damage collision would then be restored.

It all sounds simple enough on paper, but in practice I have no experience at all with Line Tracing & the tutorial I linked above is far too simplistic to help me out. I’ve tried looking for other tutorials covering Line Tracing but none of the ones I’ve looked at so far seem to carry the info I need to set up the interaction between the player and the enemy.

I also tried asking for help on UE4 AnswerHub but my question disappeared after I edited it after a almost two month long period of getting no responses, with my question still missing several days later.

EDIT: Nevermind about part, my question finally appeared.

So can anyone help me out here? I just don’t know what to do, I don’t know how to set up a line trace to work in the manner that I want it to or where to look for such information. As a result, I’m completely in over my head with matter and in a desperate need of help, so please help in any that you can.


You could probably check for the tag or Cast to the enemy pawn from the hit result.

Please can u help me here-[RAYMARCHED] Infinite Spheres. - Rendering - Unreal Engine Forums

Thanks for the response, although I’m not entirely sure what you mean by “check by tag”.

Anyways, my primary concern is that I need to somehow create a branching condition that when the Line Trace detects a hit from the player landing on the enemy, the damage collision from the enemy would be temporally disabled as long as the player is in contact with the enemy, otherwise the player would end up taking damage when they not supposed to.

Something kinda like , for example:

  • If Line Trace detection = True, then Null Damage = On
  • If Line Trace detection = False, then Null Damage = Off

I tried to see if I could create the branching condition by attaching a Branch event to the LineTraceByChannel & accompanying Break Hit Result events like in the example screenshot above, but for whatever reason it appears that you can’t directly connect the Branch event to the Break Hit Result, so now I’m stuck with no idea on what to do now.

Well, the solution depends on your current setup and design.

So I believe that you can use the first part of your idea is good and simple
-If Line Trace detection = True, then Null Damage = On

-Tag Check
-Does Implement Interface
-Cast to a specific actor

But the second part needs some more iteration.
I have two suggestions:

1.Save the Enemy actor if the linetrace hit -> “Next frame” -> Check if Linetrace hit anything or Linetrace hit other actor -> Set Trace detection = False
2. Set a function on the Enemy actor which disable its collider for a specific amount of time. Everytime the Linetrace hit the actor, it retrigger the time, simple solution could be “retriggerable delay”

I cannot access the reference link in your thread.
I advise you to write a private message next time instead of hijacking someone else’s thread.

Okay, so I figured out how to attach a Branch event from the LineTraceByChannel event but now what?

I tried following the example from the link in my initial post and created two custom events with the intent that they would be used to communicate the results of the line trace to the enemy blueprint. The problem though is that I don’t know how to re-tool my enemy’s blueprint setup so that it can receive the necessary information from the two custom events from the player’s own blueprint.

For reference, is what the current setup for the basic enemy’s blueprint looks like:

I have absolutely no idea of what I’m doing and while I appreciate the help, recommended setup below is completely different then the one I have right now, which only makes things much more confusing for me.

For one thing, setup uses LineTraceByObject instead of LineTraceByChannel like in the tutorial video I’ve been using for help. Is it better to use LineTraceByObject or LineTraceByChannel in circumstance? I honestly don’t know.

Not helping matters is that I don’t know what the Cast To Character, Does Implement Interface, and Actor Has Tag events do exactly. I tried watching the three video tutorials linked, but even after watching them I still don’t have a great gasp on how they should implemented into my setup.

So following some advice I got elsewhere, I tried changing the line trace setup in my player character’s blueprint to :

While also altering the enemy’s jump collision from :;base64

To :;base64

Unfortunately, the end result is that the jump collision isn’t working at all, with the player taking damage from landing on the enemy, with the enemy being completely unharmed.

I’ve also been getting continuously repeating error in the Message Log:


Does anyone know what I’m doing wrong?

I tried searching for “Accessed None trying to read property” on Google but so far I’ve come up empty-handed on what’s causing problem is and how to fix it.

Can’t anyone help me out?