Description
The UseHitPosition
method in the PhysicsTraceBuilder
class allows you to specify whether the trace should use the hit position when calculating the trace result. This can be useful when you need to determine the exact point of impact during a physics trace operation.
Usage
To use the UseHitPosition
method, call it on an instance of PhysicsTraceBuilder
and pass a boolean value indicating whether to enable or disable the use of hit position:
PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder.UseHitPosition(true); // Enable use of hit position
Example
PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder.UseHitPosition(true);
PhysicsTraceResult result = traceBuilder.Run();
if (result.Hit)
{
Vector3 hitPosition = result.HitPosition;
// Use hitPosition for further logic
}