Beginner: Inconsistent overlaps using a dynamic selection box

Hi, I have been trying to make a dynamic selection box for a future RTS game, but have been having some issues getting consistent overlap results with the box component that the player draws. The overall idea of the code is as follows:

  1. Create a box component in the player
  2. When the user clicks,
    begin drawing mode, and update the
    size of the box on tick, as long as
    LMB is not released.
  3. When LMB is released, check for overlapping
    actors in the final box and save
    them as the selected actors.

The problem that I am having is that the box appears to be overlapping actors, but will not return them when LMB is released sometimes (particularly common when the drawn box is quite large). The correct actors are generally returned when the size of the box is relatively small.

I have attached a picture of the collision boxes that appear to be overlapping the actor (the small cuboid), but nothing has been returned. The three key functions in the cpp are also included below (SelectionBox is the drawn box, which is a UBoxComponent).

Any help would be appreciated - struggling to figure out why there are inconsistent results here!

void ASPlayerController::StartSelection()
	bDrawing = true;

	FHitResult Hit;
	GetHitResultUnderCursor(ECC_Visibility, false, Hit);

	StartPoint = Hit.ImpactPoint;



void ASPlayerController::Tick(float DeltaTime)

	if (bDrawing)
		FHitResult Hit;
		GetHitResultUnderCursor(ECC_Visibility, false, Hit);

		FVector BoxSize;
		BoxSize.X = (Hit.ImpactPoint.X - StartPoint.X)/2;
		BoxSize.Y = (Hit.ImpactPoint.Y - StartPoint.Y)/2;
		BoxSize.Z = DefaultSelectionDepth;

		FVector UpdateStartPoint;
		UpdateStartPoint.X = StartPoint.X - (StartPoint.X - Hit.ImpactPoint.X)/2;
		UpdateStartPoint.Y = StartPoint.Y - (StartPoint.Y - Hit.ImpactPoint.Y)/2;
		UpdateStartPoint.Z = StartPoint.Z;


void ASPlayerController::CheckSelection()
	ASBaseUnit* SelectedActor;

	// Find newly overlapped actors
	TArray<AActor*> Overlapped;

	for (uint8 i = 0; i < Overlapped.Num(); ++i)
		SelectedActor = Cast<ASBaseUnit>(Overlapped[i]);

		if (SelectedActor)

	bDrawing = false;  

After a lot more playing around and digging I figured out the cause of this. It seems that the collision box is displayed correctly, but when negative box extents are applied, overlapping actors are not considered (not exactly sure why they are not considered in this situation though).

The solution was therefore to set the box extent only using absolute values, in which case it works fine.