MeshTraceRequest WithAnyTags( System.String[] tags )

book_4_sparkGenerated
code_blocksInput

Description

The WithAnyTags method is part of the MeshTraceRequest struct within the Sandbox.Engine.Utility.RayTrace namespace. This method allows you to specify a set of tags that the mesh trace should consider. When the trace is executed, it will include any objects that have at least one of the specified tags.

Usage

To use the WithAnyTags method, you need to have an instance of MeshTraceRequest. You can then call this method with an array of strings representing the tags you want to include in the trace. This method returns a modified MeshTraceRequest instance that includes the specified tags in its criteria.

Example

// Create a new MeshTraceRequest
MeshTraceRequest traceRequest = new MeshTraceRequest();

// Define tags to include in the trace
string[] tags = { "enemy", "obstacle", "collectible" };

// Configure the trace request to include any of the specified tags
traceRequest = traceRequest.WithAnyTags(tags);

// Run the trace
MeshTraceRequest.Result result = traceRequest.Run();

// Check if the trace hit any object
if (result.Hit)
{
    // Process the hit result
    // Example: Log the hit object
    // Log(result.HitObject);
}