MeshTraceRequest Trace { get; set; }

book_4_sparkGenerated
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 is useful for detecting intersections or collisions with objects in the scene.

Usage

To use the Trace property, you can access it directly from an instance of SceneWorld. It returns a MeshTraceRequest object, which you can configure to perform specific ray tracing operations.

Example

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

// Configure the trace request
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

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

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