SceneTrace HitTriggersOnly()

robot_2Generated
code_blocksInput

Description

The HitTriggersOnly method in the SceneTrace struct is used to configure a trace to only register hits with trigger objects. This method is part of the filtering options available for scene traces, allowing developers to specify that only trigger objects should be considered during the trace operation.

Usage

To use the HitTriggersOnly method, you should first create a SceneTrace object. Then, call the HitTriggersOnly method on this object to set the trace to only hit trigger objects. This is useful when you want to ignore all other types of objects in the scene and focus solely on triggers.

Example

// Example of using HitTriggersOnly in a SceneTrace
SceneTrace trace = new SceneTrace();
trace = trace.HitTriggersOnly();

// Configure other trace parameters as needed
trace = trace.FromTo(startPosition, endPosition);

// Run the trace
SceneTraceResult result = trace.Run();

// Check if a trigger was hit
if (result.Hit)
{
    // Handle the hit trigger
    GameObject hitObject = result.Entity;
    // Perform actions with the hit trigger object
}