Description
The MeshesOnly
method in the Editor.Trace
struct is used to configure a trace operation to only consider mesh geometry, specifically the CMapMesh nodes, when performing the trace. This is particularly useful when you want to ignore other types of geometry or entities in the scene and focus solely on the mesh data defined in Hammer.
Usage
To use the MeshesOnly
method, you need to have an instance of the Editor.Trace
struct. This method modifies the trace settings to ensure that only mesh geometry is considered during the trace operation. It is typically used in conjunction with other trace configuration methods and the Run
method to execute the trace.
Example
// Create a new trace instance
Editor.Trace trace = new Editor.Trace();
// Configure the trace to only consider mesh geometry
trace = trace.MeshesOnly();
// Define the start and end points of the trace
Vector3 start = new Vector3(0, 0, 0);
Vector3 end = new Vector3(10, 10, 10);
// Run the trace in the specified world
Editor.MapDoc.MapWorld world = GetMapWorld(); // Assume this is a method that retrieves the current map world
Editor.TraceResult result = trace.Run(world);
// Process the result
if (result.Hit)
{
// Handle the hit result
// For example, log the hit position
Log.Info($"Hit position: {result.Position}");
}