Description
The WithTag
method of the SceneTrace
struct allows you to filter the trace results to only include entities that have a specific tag. This method is useful when you want to narrow down the trace results to entities that are categorized or labeled with a particular tag. If you call this method multiple times with different tags, the trace will only return entities that have all the specified tags.
Usage
To use the WithTag
method, call it on an instance of SceneTrace
and pass the desired tag as a string parameter. This will configure the trace to only consider entities with the specified tag.
Example
// Example of using WithTag method
SceneTrace trace = new SceneTrace();
trace = trace.WithTag("Enemy");
// Run the trace
SceneTraceResult result = trace.Run();
// Check if the trace hit an entity with the "Enemy" tag
if (result.Hit)
{
// Handle the hit
}