Description
The WithCollisionRules
method in the PhysicsTraceBuilder
class allows you to specify collision rules for a physics trace. This method is used to define how the trace should interact with objects that have specific tags, and whether these interactions should be treated as triggers.
Usage
To use the WithCollisionRules
method, you need to provide a tag and a boolean value indicating whether the interaction should be treated as a trigger. The method returns the PhysicsTraceBuilder
instance, allowing for method chaining.
Parameters:
tag
(System.String
): The tag associated with the objects you want to define collision rules for.
asTrigger
(System.Boolean
): A boolean value indicating whether the collision should be treated as a trigger.
Example
// Example of using WithCollisionRules
PhysicsTraceBuilder traceBuilder = new PhysicsTraceBuilder();
traceBuilder = traceBuilder.WithCollisionRules("enemy", true);
// This sets up a trace that will interact with objects tagged as "enemy"
// and treat these interactions as triggers.