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

book_4_sparkGenerated
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 CollisionRules.Result which indicates the outcome of the collision 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 CollisionRules.Result that describes how these two objects should interact when they collide.

Example

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

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