int Triangle

robot_2Generated
code_blocksInput

Description

The Triangle field represents the index of the triangle that was hit during a physics trace, if the trace intersected with a mesh physics shape. This information is useful for determining the specific part of a mesh that was impacted by the trace.

Usage

Use the Triangle field to identify which triangle of a mesh was hit during a physics trace. This can be particularly useful in scenarios where you need to apply specific logic based on the exact part of a mesh that was impacted, such as applying damage to a specific area of a model.

Example

// Example of using the Triangle field in a physics trace result
PhysicsTraceResult traceResult = PerformPhysicsTrace();

if (traceResult.Hit)
{
    int hitTriangleIndex = traceResult.Triangle;
    // Use the hitTriangleIndex to perform specific logic
    Console.WriteLine($"Hit triangle index: {hitTriangleIndex}");
}