Description
The WithAllTags
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 must all be present on the objects to be considered in the ray tracing operation. It is useful for filtering the objects that the ray trace will interact with, ensuring that only objects with all specified tags are included in the trace.
Usage
To use the WithAllTags
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 filter by. The method returns a modified MeshTraceRequest
instance that includes the tag filtering criteria.
Example usage:
MeshTraceRequest request = new MeshTraceRequest();
request = request.WithAllTags(new string[] { "tag1", "tag2" });
In this example, the ray trace will only consider objects that have both "tag1" and "tag2".
Example
MeshTraceRequest request = new MeshTraceRequest();
request = request.WithAllTags(new string[] { "tag1", "tag2" });
// Run the trace
MeshTraceRequest.Result result = request.Run();
// Check if the trace hit something
if (result.Hit)
{
// Process the hit result
var hitObject = result.HitObject;
// Additional logic here
}