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.
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 interact with the environment, such as avoiding hitting their head on low ceilings or determining if they can stand up from a crouched position.
Example
// Example of using the Headroom property
public void CheckHeadroom(PlayerController playerController)
{
float headroom = playerController.Headroom;
if (headroom < 1.0f)
{
// Not enough headroom to stand up
Console.WriteLine("Watch your head!");
}
else
{
// Safe to stand up
Console.WriteLine("Plenty of space above.");
}
}