Description
The Distance
property of the SceneTraceResult
struct represents the distance between the start and end positions of a trace operation within a scene. This property is read-only and provides a single-precision floating-point value indicating how far the trace traveled before hitting an object or reaching its endpoint.
Usage
Use the Distance
property to determine how far a trace operation has traveled in a scene. This can be useful for calculating the length of a trace or for determining if a trace has reached a certain distance threshold.
Example
// Example of using the Distance property
SceneTraceResult traceResult = SceneTraceResult.From(scene, ref physicsTraceResult);
float traceDistance = traceResult.Distance;
// Check if the trace traveled more than 10 units
if (traceDistance > 10.0f)
{
// Perform some action if the trace is longer than 10 units
}