Description
The IsOnGround
property of the PlayerController
class indicates whether the player is currently standing on the ground. This property is useful for determining if the player can perform actions that require ground contact, such as jumping or walking.
Usage
Use the IsOnGround
property to check if the player is on the ground before executing actions that require ground contact. This can help prevent actions like jumping when the player is in the air.
Example
// Example of using IsOnGround property
public void HandleJump()
{
if (playerController.IsOnGround)
{
// Allow the player to jump
playerController.Jump(new Vector3(0, 0, 10));
}
else
{
// Player is not on the ground, cannot jump
// Handle accordingly
}
}