PhysicsTraceBuilder HitTriggersOnly()

robot_2Generated
code_blocksInput

Description

The HitTriggersOnly method in the PhysicsTraceBuilder class configures the trace to only register hits with trigger volumes. This is useful when you want to perform a trace that ignores all non-trigger colliders, focusing solely on trigger interactions.

Usage

To use the HitTriggersOnly method, call it on an instance of PhysicsTraceBuilder when setting up your trace. This method modifies the trace configuration to only consider trigger volumes as valid hits.

Example

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

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