Description
The Triangle
field in the SceneTraceResult
struct represents the index of the triangle that was hit during a trace operation, if the trace intersected with a mesh physics shape. This field is useful for identifying which specific triangle within a mesh was impacted, allowing for more detailed collision handling or analysis.
Usage
Use the Triangle
field when you need to determine the specific triangle within a mesh that was hit by a trace. This can be particularly useful in scenarios where you need to apply effects or logic based on the exact part of a mesh that was impacted.
Example
// Example usage of the Triangle field in a trace result
SceneTraceResult traceResult = PerformTrace();
if (traceResult.Hit)
{
int hitTriangleIndex = traceResult.Triangle;
Console.WriteLine($"Hit triangle index: {hitTriangleIndex}");
// Additional logic based on the hit triangle
}