MeshTraceRequest Trace { get; set; }

robot_2Generated
code_blocksInput

Description

The Trace property in the SceneWorld class provides a mechanism to perform ray tracing against all scene objects within the current scene world. This property returns a MeshTraceRequest object, which can be used to configure and execute ray tracing operations.

Usage

To use the Trace property, you can access it directly from an instance of SceneWorld. The returned MeshTraceRequest object allows you to specify parameters for the ray trace, such as the origin, direction, and any filters or conditions for the trace.

Example

// Example of using the Trace property in SceneWorld
SceneWorld sceneWorld = new SceneWorld();

// Configure a ray trace
var traceRequest = sceneWorld.Trace;
traceRequest.Start = new Vector3(0, 0, 0); // Starting point of the ray
traceRequest.End = new Vector3(100, 0, 0); // Ending point of the ray

// Execute the trace
var traceResult = traceRequest.Run();

if (traceResult.Hit)
{
    // Handle the hit result
    var hitObject = traceResult.Entity;
    // Do something with the hit object
}