Description
The WithoutTags
method of the MeshTraceRequest
struct allows you to specify a set of tags that should be excluded from the ray tracing operation. This method is useful when you want to perform a ray trace but ignore certain objects that are associated with specific tags.
Usage
To use the WithoutTags
method, call it on an instance of MeshTraceRequest
and pass an array of strings representing the tags you want to exclude. This method returns a modified MeshTraceRequest
instance that can be further configured or executed.
Example
// Example usage of WithoutTags method
var traceRequest = new MeshTraceRequest();
// Exclude objects with the tags "enemy" and "obstacle"
traceRequest = traceRequest.WithoutTags(new string[] { "enemy", "obstacle" });
// Run the trace
var result = traceRequest.Run();
// Check if the trace hit something
if (result.Hit)
{
// Process the hit result
var hitPosition = result.Position;
// Additional logic here
}