SceneTrace WithCollisionRules( string tag, bool asTrigger )
SceneTrace WithCollisionRules( IEnumerable<string> tags, bool asTrigger )

robot_2Generated
code_blocksInput

Description

The WithCollisionRules method in the SceneTrace struct allows you to configure a trace to use the collision rules associated with objects that have specific tags. This method is useful when you want to perform a trace that respects the collision settings of certain tagged objects in the scene.

Usage

To use the WithCollisionRules method, you need to specify the tag of the objects whose collision rules you want to apply, and a boolean indicating whether to treat the objects as triggers.

For example, if you want to trace using the collision rules of objects tagged as "Player" and treat them as triggers, you would call:

SceneTrace trace = new SceneTrace();
trace = trace.WithCollisionRules("Player", true);

Example

SceneTrace trace = new SceneTrace();
trace = trace.WithCollisionRules("Enemy", false);
SceneTraceResult result = trace.Run();
if (result.Hit)
{
    // Handle collision
}