PhysicsTraceBuilder HitTriggers()

robot_2Generated
code_blocksInput

Description

The HitTriggers method of the PhysicsTraceBuilder class is used to include trigger entities in the physics trace. By default, physics traces may not consider trigger entities, which are typically used for detecting overlaps or interactions without physical collision responses. This method modifies the trace to account for these entities, allowing them to be detected during the trace operation.

Usage

To use the HitTriggers method, call it on an instance of PhysicsTraceBuilder when setting up your trace. This will ensure that any trigger entities encountered during the trace are included in the results.

Example

// Example of using HitTriggers in a physics trace
PhysicsTraceBuilder trace = new PhysicsTraceBuilder();
trace = trace.HitTriggers();
PhysicsTraceResult result = trace.Run();

if (result.Hit)
{
    // Handle the hit with a trigger
    Entity hitEntity = result.Entity;
    // Perform actions based on the hit entity
}