bool IsOnGround { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The IsOnGround property of the PlayerController class indicates whether the player is currently on the ground. This boolean 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 grounded before executing actions that require ground contact. This can help prevent actions like jumping when the player is in mid-air.

Example

// Example of using IsOnGround property
public void HandleJump()
{
    if (playerController.IsOnGround)
    {
        // Execute jump logic
        playerController.Jump(new Vector3(0, 0, 10));
    }
    else
    {
        // Player is not on the ground, cannot jump
        // Handle accordingly
    }
}