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.
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.
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 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 }