Hi Guys,
I am using controller.isGrounded to check if the player is touching the ground to check if he can jump or not. Most of the times it works, but 10% of the time it doesn’t detect I am off the ground to start the jump animation. Is there another way to do this wich is more reliable?
void Update()
{
CharacterController controller = GetComponent<CharacterController>();
if(controller.isGrounded)
{
grounded = true;
}
if (!controller.isGrounded)
{
grounded = false;
}
if (Input.GetKeyDown(KeyCode.Space) && grounded == true)
{
print("We are grounded");
anim.SetBool("Jumping", true);
}
else
{
anim.SetBool("Jumping", false);
}
}