In the attached image you can see (on a really blurry, placeholder sprite):
A green ground checker, a red and blue wall checker, and 2 small “slope” checkers (blue and red).
The parameters used to Debug.DrawCube/Sphere these are the same parameters I use to do the OverlapBox/Circle checks.
As you can also see I’ve shrunk this box much smaller than the collider (for testing proposes) BUT the overlap checks for both ground (green) and wall (red and blue boxes to the sides) detect the ground (beneath Mario’s feet) even sitting this far from the ground… Why is this?
Code used:
public bool WalledCheckRight(){
return Physics2D.OverlapBox(wallCheckRightOriginV3,wallCheckRightSizeV3,0, wallMask);
}
public bool WalledCheckLeft(){
return Physics2D.OverlapBox(wallCheckLeftOriginV3,wallCheckLeftSizeV3,0, wallMask);
}
public bool GroundCheck(){
var rightCol = Physics2D.OverlapCircle(groundRightV3, groundCheckSize, floorMask);
var leftCol = Physics2D.OverlapCircle(groundLeftV3, groundCheckSize, floorMask);
var ground = (rightCol || leftCol) || Physics2D.OverlapBox(groundmiddleOriginV3, groundmiddleSizeV3, 0, floorMask);
onSlope = rightCol ^ leftCol;
return ground || onSlope;
}
