Description
The RunAll
method of the SceneTrace
class executes a trace operation and records all the objects that are hit during the trace. This method returns an enumerable collection of SceneTraceResult
objects, each representing a hit detected during the trace.
Usage
To use the RunAll
method, first create an instance of SceneTrace
and configure it with the desired parameters, such as the start and end points, shape, and filters. Then, call RunAll
to execute the trace and retrieve all hits.
Example
// Example of using SceneTrace.RunAll
SceneTrace trace = new SceneTrace();
trace.FromTo(startPosition, endPosition);
trace.Radius(1.0f); // Set the trace to a sphere with radius 1
IEnumerable<SceneTraceResult> results = trace.RunAll();
foreach (var result in results)
{
// Process each hit result
GameObject hitObject = result.Entity;
Vector3 hitPosition = result.Position;
// Additional processing...
}