Description
The Editor.Trace.Ray
method is a static method used to create a trace from one point in 3D space to another. This method is part of the Editor.Trace
struct, which is designed for tracing operations within the editor environment, specifically for tools. It should not be confused with Sandbox.SceneTrace
, which is used for scene-related tracing.
Usage
To use the Editor.Trace.Ray
method, you need to provide two Vector3
references that represent the start and end points of the trace. This method returns an Editor.Trace
object that can be further configured or executed to perform the trace operation.
Example
// Example of using Editor.Trace.Ray
Vector3 startPoint = new Vector3(0, 0, 0);
Vector3 endPoint = new Vector3(10, 0, 0);
Editor.Trace trace = Editor.Trace.Ray(ref startPoint, ref endPoint);
// Further configuration of the trace can be done here
// For example, you might want to skip certain materials or only trace meshes
trace = trace.SkipToolsMaterials();
trace = trace.MeshesOnly();
// Execute the trace
Editor.TraceResult result = trace.Run(world);