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 the specific triangle within a mesh that was impacted by the trace.
Usage
Use the Triangle
field to determine which triangle in a mesh was hit by a trace. This can be particularly useful for detailed collision detection or for applying specific logic based on the triangle that was hit.
Example
// Example of using the Triangle field in a trace result
SceneTraceResult traceResult = SceneTraceResult.From(scene, trace);
if (traceResult.Hit)
{
int hitTriangleIndex = traceResult.Triangle;
// Use the hitTriangleIndex for further processing
// For example, logging or applying specific logic
Log.Info($"Hit triangle index: {hitTriangleIndex}");
}