Thank you so much for this tutorial. It's EXTREMELY helpful. I do have a question: If the Multi Line Trace begins inside of an actor, it returns a hit value with an impact normal of (0,0,1) at its starting location. Is there some way to make the Multi Line Trace only return hit results from surface normals instead?
I just tested using my examples and printed out the Impact Normal from my character as I ran thru it. It gave me back the valid values as I expected as it hit the collision capsule on the player. The normal was correct and returning a valid value as I moved and the area it hit on the capsule changed. The only time I got back the same Normal value was if the surface was flat, which is the value I expected, or I had the Ignore Self boolean unchecked which would cause it to hit itself as the first point of contact every time. Do you have a screenshot perhaps of the issue or maybe some more details?
Of course. This picture shows the Multi Line Trace. It begins inside the glass cylinder and ends coming out of the top: gyazo.com/d9ab263ddf23eb6c2017e1da605daa5d This picture shows all of the objects and impact normals from the Multi Line Trace hits: gyazo.com/1eb83bb92009da781f5cef84f3f19b81
I can't be too sure of what is going on but some things off the top of my head. I think I see 2 traces, one in the background with 1 hit and 1 thru the bear with no hits. It looks like the trace from the back is hitting the cylinder as it leaves it and assuming its on the correct channel for your trace (possibly visibility) then that would make sense assuming your line trace nodes are in a Blueprint that is separate from your Glass Cylinder it is hitting. This having only 1 hit would make sense as it hits the cylinder and then nothing else is in the way before it ends (and why it only shows the 1 green cube for the impact). the -1 in the Z would be correct for the normal as I would think you are projecting this from below and its the impact point going down. These are all guesses of course. As for the other trace I don't really see what it is hitting, if anything at all, but that would be a completely separate trace from the looks of it as you have 2 on the screen. Check to see what your line trace channel is set to and that your desired item you want it to hit against will block that channel. It's possible you want to maybe use a line trace by object if your trace is intended to be more specific like against a player or enemy. This might work easier?
The line trace is produced by the bear's blueprint and not the cylinder. Its green hit square shows a (0,0-1) hit at its start location inside the cylinder instead of on the surface of the cylinder. I don't want it to produce any hits at all considering that it begins inside the cylinder and exits through the back of the cylinder's normal. So the problem is that, when this trace is generated from inside an object, it automatically registers a hit at its start location with a normal vector opposite to the trace's normalized vector regardless of whether it actually hits the surface of the object.
I know this is an old post, but I had the same issue and maybe this will help someone else? From the MultiLineTraceByChannel drag out from "Out Hits" to make a "For Each Loop" node. From there you can drag out from "Array Element" to your "Break Hit Result"
You are doing an amazing job explaining all those things. Keep it up it means a lot :)
Thank you so much for this tutorial. It's EXTREMELY helpful. I do have a question:
If the Multi Line Trace begins inside of an actor, it returns a hit value with an impact normal of (0,0,1) at its starting location. Is there some way to make the Multi Line Trace only return hit results from surface normals instead?
I just tested using my examples and printed out the Impact Normal from my character as I ran thru it. It gave me back the valid values as I expected as it hit the collision capsule on the player. The normal was correct and returning a valid value as I moved and the area it hit on the capsule changed.
The only time I got back the same Normal value was if the surface was flat, which is the value I expected, or I had the Ignore Self boolean unchecked which would cause it to hit itself as the first point of contact every time.
Do you have a screenshot perhaps of the issue or maybe some more details?
Of course.
This picture shows the Multi Line Trace. It begins inside the glass cylinder and ends coming out of the top:
gyazo.com/d9ab263ddf23eb6c2017e1da605daa5d
This picture shows all of the objects and impact normals from the Multi Line Trace hits:
gyazo.com/1eb83bb92009da781f5cef84f3f19b81
I can't be too sure of what is going on but some things off the top of my head.
I think I see 2 traces, one in the background with 1 hit and 1 thru the bear with no hits. It looks like the trace from the back is hitting the cylinder as it leaves it and assuming its on the correct channel for your trace (possibly visibility) then that would make sense assuming your line trace nodes are in a Blueprint that is separate from your Glass Cylinder it is hitting. This having only 1 hit would make sense as it hits the cylinder and then nothing else is in the way before it ends (and why it only shows the 1 green cube for the impact). the -1 in the Z would be correct for the normal as I would think you are projecting this from below and its the impact point going down. These are all guesses of course.
As for the other trace I don't really see what it is hitting, if anything at all, but that would be a completely separate trace from the looks of it as you have 2 on the screen. Check to see what your line trace channel is set to and that your desired item you want it to hit against will block that channel. It's possible you want to maybe use a line trace by object if your trace is intended to be more specific like against a player or enemy. This might work easier?
The line trace is produced by the bear's blueprint and not the cylinder. Its green hit square shows a (0,0-1) hit at its start location inside the cylinder instead of on the surface of the cylinder. I don't want it to produce any hits at all considering that it begins inside the cylinder and exits through the back of the cylinder's normal. So the problem is that, when this trace is generated from inside an object, it automatically registers a hit at its start location with a normal vector opposite to the trace's normalized vector regardless of whether it actually hits the surface of the object.
+Mathew Wadstein I'm referring to the Line Trace on the left, just to clarify.
You think they used something like this for collateral damage in COD games?
what is the name of that 'Get' node? I am unable to find it in my Unreal.
I know this is an old post, but I had the same issue and maybe this will help someone else? From the MultiLineTraceByChannel drag out from "Out Hits" to make a "For Each Loop" node. From there you can drag out from "Array Element" to your "Break Hit Result"
@@taylorhead9842 it helped ^^
@@maximevigneron560 💪💪
overlapp..... ohhhhhhh. thanks.
I got one question. How did you debug the linetraces like that?
You can set the "draw debug type" to "for duration" or "persistant" in the node
Is it possible to get to the location and the normal of where the trace exits the mesh?
As far as I know no. Normally to find this you would trace backwards from the end and that would give you the exit point.