Description
The Distance
property of the PhysicsTraceResult
struct represents the distance between the start and end positions of a physics trace. This value is a float
and provides a measure of how far the trace traveled before hitting an object or reaching its endpoint.
Usage
Use the Distance
property to determine how far a trace has traveled in a physics simulation. 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
PhysicsTraceResult traceResult = PerformPhysicsTrace();
// Check if the trace hit something
if (traceResult.Hit)
{
// Output the distance the trace traveled
float distanceTraveled = traceResult.Distance;
// Use the distance for further logic
if (distanceTraveled > 10.0f)
{
// Perform some action if the trace traveled more than 10 units
}
}