quarta-feira, 6 de abril de 2016

BP Compendium: MultiLineTraceByChannel

MultiLineTraceByChannel


The MultiLineTraceByChannel function has two differences from the LineTraceForObjects function. It provides as output an array that can contain several elements as a result of the collision test. The collision test is based on the "Trace Channel".  It can be seen in the details tab of a StaticMeshActor, in "Trace Responses" is defined how an object will respond to the trace test on the channels "Visibility" and "Camera". 

For example, a transparent material, will set the "Visibility" as "Overlap" because it can be viewed and does not block the line of sight. The function MultiLineTraceByChannel immediately ends if it finds an object with "Block" in the Trace Channel used.

Input

  • Start: Vector that defines the beginning of the line to be used for the collision test.
  • End: Vector that defines the end of the collision test line.
  • Trace Channel: Channel used for the collision test. It can be "Visibility" or "Camera".
  • Trace Complex, Actors to Ignore, Draw Debug Type and Ignore Self: Are the same parameters used in the LineTraceForObjects function.

Output

  • Out Hits: Array of structure "HitResult" containing the collisions that were found.
  • Return Value: Boolean value. If true, it means that a collision was found.


Example Usage

The player has a device that is activated using the "Enter" key. This device uses  the MultiLineTraceByChannel function to get objects visible and add to a radar system that the player has.

Click to enlarge


The macro TraceLocationFPS calculates the positions used in Trace based on the camera used by the player.

Click to enlarge