Collider GroundCollider { get; set; }

robot_2Generated
code_blocksInput

Description

The GroundCollider property of the CharacterController class provides access to the Collider that the character is currently standing on. This property is useful for determining the specific collider that is in contact with the character's feet, which can be used for various gameplay mechanics such as detecting the type of surface the character is on or applying specific interactions based on the collider's properties.

Usage

To access the GroundCollider property, you need to have an instance of the CharacterController component. Once you have the instance, you can simply access the property to get the current ground collider.

Example

// Assuming 'characterController' is an instance of CharacterController
Collider currentGroundCollider = characterController.GroundCollider;

if (currentGroundCollider != null)
{
    // Perform operations with the ground collider
    // For example, check the material or type of the collider
    var material = currentGroundCollider.Material;
    // Implement logic based on the material
}