book_4_sparkGenerated
code_blocksInput

Description

The RunAll method of the SceneTrace struct executes a trace operation within the scene 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, you first need to configure a SceneTrace object with the desired parameters, such as the start and end points, the shape of the trace, and any filters or conditions. Once configured, call RunAll to execute the trace and retrieve all hits.

Example

// Example of using SceneTrace.RunAll
SceneTrace trace = new SceneTrace();
trace.FromTo(startPosition, endPosition)
     .Radius(0.5f) // Set the trace to be a sphere with a radius of 0.5
     .UsePhysicsWorld(true); // Enable tracing against physics objects

IEnumerable<SceneTraceResult> results = trace.RunAll();

foreach (var result in results)
{
    // Process each hit result
    GameObject hitObject = result.Entity;
    Vector3 hitPosition = result.Position;
    // Additional processing...
}