Description
The WithAnyTags
method in the PhysicsTraceBuilder
class allows you to specify a set of tags that the trace should consider. If any of the specified tags are present on an object, the trace will include that object in its results. This is useful for filtering trace results based on specific criteria defined by tags.
Usage
To use the WithAnyTags
method, call it on an instance of PhysicsTraceBuilder
and pass an array of strings representing the tags you want to include in the trace. The method returns the same PhysicsTraceBuilder
instance, allowing for method chaining.
Example
// Example usage of WithAnyTags method
PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder.WithAnyTags(new string[] { "enemy", "obstacle" });
// Continue building the trace
traceBuilder.FromTo(startPosition, endPosition);
PhysicsTraceResult result = traceBuilder.Run();
// Check if the trace hit any objects with the specified tags
if (result.Hit)
{
// Handle the hit
}