In Unity (2019.2) I'm trying to use a boxcast on a beam weapon of width > 0. Using a raycast for this beam test works correctly, but the BoxCast returns zero results.
I'm not using any depth, distance, or layermask filters.
colCountRay = Physics2D.RaycastNonAlloc(e.pos, Vector2.up, collsRay);
...correctly returns the hit objects, populating collsRay and setting colCountRay to the number of hit objects. But replacing that rayCast with this...
colCountRay = Physics2D.BoxCastNonAlloc(e.pos, Vector2.right, 0, Vector2.up, collsRay);
...colCountRay is zero
I'm using this script to visualise the box cast and it's overlapping correctly...
https://answers.unity.com/questions/1156087/how-can-you-visualize-a-boxcast-boxcheck-etc.html
I've used boxcast before in another game so I'm completely stumped here! All the tested objects have 2D colliders and a kinematic RigidBody2D. Physics2D layer filters are enabled in Settings for collisions between all objects, although that shouldn't affect the boxCast results.
Looks like you are casting a box with height 0? Could you try to use a non-zero sized box for the casting, and see if that works?