book_4_sparkGenerated
code_blocksInput

Description

The SetPair method is used to define the collision rule between two specified collision layers within the collision matrix. This method updates the collision matrix to reflect whether the two layers should collide or not based on the provided rule.

Usage

To use the SetPair method, you need to provide the names of the two collision layers and the collision rule that should be applied between them. The collision rule is specified using the Sandbox.Physics.CollisionRules.Result enumeration, which determines the interaction between the layers.

Example

// Example usage of SetPair method
CollisionMatrixWidget collisionMatrixWidget = new CollisionMatrixWidget();

// Define collision rule between "LayerA" and "LayerB"
string layerA = "LayerA";
string layerB = "LayerB";
Sandbox.Physics.CollisionRules.Result collisionRule = Sandbox.Physics.CollisionRules.Result.Collide;

// Set the collision rule
collisionMatrixWidget.SetPair(layerA, layerB, collisionRule);