I’m using Physics2D.OverlapCircle to know if the player is grounded or not. If “isGrounded” it’s true, the animations plays, the player can jump, etc. However, I need to have more layers in the layerMask (the ground and platform layers), but I don’t know how to combine them so that the program knows that I want “isGrounded” to be true when the player it’s stepping on the ground or a platform layer. Here is my code:
[Space]
[Header("Ground check variables")]
public Transform groundCheck;
public LayerMask groundLayer;
public LayerMask platformLayer;
public bool isGrounded;
public float groundCheckRadius;
void Grounded()
{
var groundCollider = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, groundLayer); // groundLayer is where I need to combine more layers
isGrounded = groundCollider != null;
}
Any hint in the right direction or documentation is really appreciated!