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 the character is interacting with on the ground, which can be used for various gameplay mechanics such as surface-specific interactions or effects.

Usage

To access the GroundCollider property, you need to have an instance of the CharacterController class. You can then retrieve the collider that the character is currently standing on by simply accessing this property.

Example

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

if (groundCollider != null)
{
    // Perform operations with the ground collider
    // For example, check the type of surface the character is on
    string surfaceType = groundCollider.SurfaceType;
    // Implement logic based on the surface type
}