Sandbox.Physics.CollisionRules/Result GetCollisionRule( string left, string right )

robot_2Generated
code_blocksInput

Description

The GetCollisionRule method in the Sandbox.Physics.CollisionRules class is used to determine the collision rule between two specified tags. This method returns a Result which indicates the collision behavior between the two tags.

Usage

To use the GetCollisionRule method, you need to provide two string parameters representing the tags of the objects you want to check for collision rules. The method will return a Result that describes how these two tags interact in terms of collision.

Example

// Example usage of GetCollisionRule method
var collisionRules = new Sandbox.Physics.CollisionRules();
var result = collisionRules.GetCollisionRule("Player", "Wall");

switch (result)
{
    case Sandbox.Physics.CollisionRules.Result.Ignore:
        // Handle ignore collision
        break;
    case Sandbox.Physics.CollisionRules.Result.Collide:
        // Handle collide
        break;
    case Sandbox.Physics.CollisionRules.Result.Trigger:
        // Handle trigger
        break;
    default:
        // Handle default case
        break;
}