so I have a character with the attributes “Grounded” and “onWall”, which are booleans that correspond to whether the character is touching the ground or the wall. how I have it set up now, they are set to true on collision enter, and to false on collision exit with the ground or wall. also, Grounded overwrites onWall, so if the character is on a wall and then starts touching the ground, Grounded is set to true and onWall is false even if they are still touching the wall. the issue with this is that if the character is touching a wall, then starts touching the ground, then jumps, and remains in contact with the wall the whole time, onWall will be false. is there a way to check on command if it is contacting the wall? like that I can use in an if statement.
Grounded overwrites onWall
Well… don’t make the grounded change the walue of onWall. Those variables are meant to remember if you are touching a wall and or ground. If you want a different behaviour, like, not doing the onWall stuff when also grounded, then simply check for both variable values.
To answer the original question, you can use the collider function IsTouchingLayers
to manually check if a collider is touching other colliders with a specific LayerMask
.