I am attempting to make a hitscan gun for my 2d fighter. I am creating a mask so the raycast ignores the player that is shooting like so:
` int mask = ~(1 << 12 + CurrentPlayer);
RaycastHit2D hit = Physics2D.Raycast(transform.position, direction, Mathf.Infinity, mask);
if (hit.collider != null)
{
Debug.Log(hit.collider.tag);
}``
With this as my layer setup:
This is not working, and I am having a lot of trouble figuring out why. I am able to get the raycast to detect the shooting player by removing the mask, but never anything else. Any help would be appreciated, thanks!