float Headroom { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Headroom property represents the distance from the top of the player's head to the closest ceiling. This property is useful for determining if there is enough space above the player to perform certain actions, such as standing up from a crouched position or jumping without hitting the ceiling.

Usage

Use the Headroom property to check the available space above the player's head. This can be particularly useful in scenarios where the player needs to navigate through environments with varying ceiling heights.

Example

// Example of using the Headroom property
public void CheckHeadroom()
{
    PlayerController playerController = new PlayerController();
    float headroom = playerController.Headroom;
    
    if (headroom > 1.0f)
    {
        // Enough space to stand up or jump
        // Perform actions that require more headroom
    }
    else
    {
        // Not enough space
        // Restrict certain actions
    }
}