Description
The UseCollisionRules
property of the CharacterController
class determines whether the character controller should use the current project's collision rules based on the Tags
of the containing GameObject
. When enabled, the character controller will adhere to the collision rules defined in the project, allowing for more precise and context-aware collision handling.
Usage
To use the UseCollisionRules
property, simply set it to true
or false
depending on whether you want the character controller to follow the project's collision rules. This can be useful in scenarios where you want to ensure that the character interacts with the environment according to predefined rules, such as ignoring certain objects or colliding only with specific types of objects.
Example
// Example of setting the UseCollisionRules property
CharacterController characterController = new CharacterController();
// Enable the use of project collision rules
characterController.UseCollisionRules = true;
// Disable the use of project collision rules
characterController.UseCollisionRules = false;