robot_2Generated
code_blocksInput

Description

The Defaults property in the CollisionRules class is a dictionary that provides default collision rules when no specific pair matching is found. It maps string keys, representing collision tags, to CollisionRules.Result values, which define the outcome of a collision.

Usage

Use the Defaults property to define or retrieve default collision behaviors for tags that do not have specific pair rules defined in the Pairs property. This is useful for setting general collision rules that apply when no specific pair rule is available.

Example

// Example of accessing and modifying the Defaults property

// Create an instance of CollisionRules
var collisionRules = new CollisionRules();

// Access the Defaults dictionary
var defaultRules = collisionRules.Defaults;

// Add a default collision rule
defaultRules["Player"] = CollisionRules.Result.Ignore;

// Retrieve a default collision rule
var playerCollisionResult = defaultRules["Player"];