Description
The UseHitPosition
method in the SceneTrace
struct is used to specify whether the hit position should be computed during a trace operation. This can be useful when you need precise information about where a trace intersects with an object in the scene.
Usage
To use the UseHitPosition
method, call it on an instance of SceneTrace
and pass a boolean value indicating whether you want to compute the hit position. If true
, the trace will calculate and store the hit position; if false
, it will not.
Example
// Example of using UseHitPosition
SceneTrace trace = new SceneTrace();
trace = trace.UseHitPosition(true);
// Continue setting up the trace as needed
trace = trace.FromTo(startPosition, endPosition);
trace = trace.Run();
// Check the result
if (trace.Hit)
{
Vector3 hitPosition = trace.HitPosition;
// Use hitPosition as needed
}