Using a Multi Line Trace (Raycast) by Channel

MultiLineTraceByChannel will perform a collision trace along a given line and return all hits encountered (up to and including) the first blocking hit, returning only objects that respond to the specified Trace Channel. What this means (practically), is that if their are a number of Actors or Components with collision that Overlap the specified Trace Channel between the start and the end of the trace, you will recieve them all. But, if the first hit Blocks the specified Trace Channel, you will only recieve that one item. If you want to recieve all items regardless of overlap, or blocking a trace channel, you should use a MultiLineTraceByObject node. Below, you will find steps for setting up MultiLineTraceByChannel.

Steps

  1. Follow the steps used for the LineTraceByChannel example to set up a trace.

  2. Replace the LineTraceByChannel node with the MultiLineTraceByChannel node.

  3. Drag off the Out Hits pin and add a ForEachLoop node.

    GHT2B_18.png

    Since multiple Actors are hit, for each of them, we want to do something (in this example, print the Actors to the screen).

  4. Drag off the Array Element and add a Break Hit Result. Then, drag off the Hit Actor, add a Get Display Name (Object) and connect to a Print String.

    Click image for a full view.

    This will now print to the string each of the Actors hit by the array.

Result

Here, we have a Glass Window in front of a Physics Actor.

GHT2B_17.png

The Glass Window is a Destructible Mesh, and we have set its Trace Response to Visibility in its collision settings, which is set to Overlap; while the Physics Actor (Cube) has its Visibility setting to Block. You could use this for situations where you may want to shoot through an object (destroying it) while also hitting an enemy.