I did a function that tells if the player is grounded or not, in order to avoid jumping mid air. But when testing it, the player is able to jump endlessly, unless it’s already going down.
private bool isGrounded(){
RaycastHit2D playerToGround = Physics2D.Raycast(transform.position + (new Vector3(0, -0.5f)), Vector2.down, 0.2f);
return playerToGround == true;
}
I cant figure out what’s wrong, i have used a couple of ways of using raycast, and had the same problem