robot_2Generated
code_blocksInput

Description

The Run method of the SceneTrace struct executes the trace operation and returns the result of the first hit encountered. This method is useful for determining the first object that a trace intersects with in the scene.

Usage

To use the Run method, first configure a SceneTrace object with the desired parameters, such as the start and end points, shape, and any filters. Then, call the Run method to execute the trace and obtain the result.

Example

// Example of using SceneTrace.Run
SceneTrace trace = new SceneTrace();
trace.FromTo(startPosition, endPosition);
trace.Radius(0.5f); // Set the trace to be a sphere with a radius of 0.5

SceneTraceResult result = trace.Run();

if (result.Hit)
{
    // Process the hit result
    GameObject hitObject = result.Entity;
    Vector3 hitPosition = result.Position;
    // Additional logic here
}