2D Collider seems bigger than it is

HI there, I’ve got a player and a wall with colliders attached. I have also attached a script to the player that uses Physics2D.BoxCast for the collision detection. The problem is that the collision happens before both collision boxes actually touch so there is a gap between the wall and player.

192428-capture11.png

Here is the problem, the player wont get any closer to the wall, also you can see the box colliders here

Also here is the code that casts the BoxCast on the x direction

thank you all in advance.

I am not sure I completely understand the problem, but from what I understand my best guess would be that the boxCast direction and distance is set using the movement, but it is called before the movement is actually made. So it is casting to where the player would be and since it hits a collider at the next spot the player will be hit is no longer equal null so it does not move the player.