LineTraceForObjects
The LineTraceForObjects function tests the collision along a defined line and returns the first found object that belongs to one of the object types specified in the function call.
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.
- Object Types: Array that contains the types of objects that will be tested in the collision.
- Trace Complex: Boolean value indicating whether to use complex collisions.
- Actors to Ignore: Array with the actors that should be ignored in the collision tests.
- Draw Debug Type: It allows the drawing of the line that is being used in the collision test.
- Ignore Self: Boolean value that indicates whether the Blueprint that is calling the function should be ignored in the collision test.
Output
- Out Hit: Structure "HitResult" that contains various information about the collision found.
- Return Value: Boolean value. If true, it means that a collision was found.
Example Usage:
On a blueprint called "AlarmDevice", the LineTraceForObjects function is used to activate an alarm if an object of the Pawn type is detected. The image below shows this example. A macro was used to get the start and end locations of the line.
Click to enlarge |
To create the array with the type of objects, drag off the pin "Object Types" and choose the "Make Array" option.
The TraceLocations macro looked like this:
Click to enlarge |