Using a Single Line Trace (Raycast) by Object

LineTraceForObjects will perform a collision trace along a given line and return the first Object the trace hits that matches one of the specified Object Types. To set up LineTraceForObjects trace, do the following:

Steps

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

  2. Replace the LineTraceByChannel node with the LineTraceForObjects node.

  3. Drag off the Object Types pin and add the Make Array node.

    GHT2B_12.png

  4. On the Make Array node, specify the ObjectType you want to trace for (via the drop-down menu).

    GHT2B_13.png

    Here, we are tracing for WorldDyanmic Objects. You can add more by clicking the Add Pin button.

  5. You can set the rest of the trace up the same way a LineTraceByChannel is setup.

    Click image for a full view.

Result

We have added a single WorldDynamic Object into our level.

GHT2B_16.png

Only the added Actor is now returning as a hit; consequently, the cubes (since they are Physics Actors) do not return a hit.