Let’s say trooper unit A is standing in front of trooper unit B.
Is the attacker able to attack Unit B, or does the attacker have to attack the closest unit?
If they are able to attack unit A, then the attacker is able to shoot through unit B without unit B sustaining any causalities.
Maybe this explains how C-3PO and R2 are able to walk across that hallway in A New Hope without getting hit by shots.