Description
The Triangle
field represents the index of the triangle that was hit during a scene trace, if the trace intersected with a mesh physics shape. This field is part of the SceneTraceResult
structure, which provides detailed information about the result of a trace operation in the scene.
Usage
Use the Triangle
field to determine which specific triangle of a mesh was hit during a trace. This can be useful for applications that require precise collision detection or interaction with specific parts of a mesh.
Example
// Example of accessing the Triangle field from a SceneTraceResult
SceneTraceResult traceResult = SceneTraceResult.From(scene, trace);
int hitTriangleIndex = traceResult.Triangle;
if (hitTriangleIndex != -1)
{
// A triangle was hit, process accordingly
// For example, log the triangle index
Log.Info($"Hit triangle index: {hitTriangleIndex}");
}