Problem with OnOverlapBegin

Hello!

I’m trying to make my character able to pick up projectiles on LMB and I need some help.

“Pick up” action works only when LMB is pressed before character collides with projectile. But if character already collides with projectile, LMB will do nothing and projectile is not destroyed.

void AFPSBall::OnOverlapBegin(UPrimitiveComponent * OverlappedComp, AActor * OtherActor, UPrimitiveComponent * OtherComp,
	int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
	AFPSCharacter* player = Cast<AFPSCharacter> (OtherActor);
	checkingPickUp = player->requestPickUp;
	if (checkingPickUp == true)
	{
		if ((OtherActor != nullptr) && (OtherActor != this) && (OtherComp != nullptr))
		{
			Destroy();
			checkingThrown = false;
			player->ballIsThrown = checkingThrown;
			GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Green, TEXT("Ball is picked up"));
		}
	}
}

FPSCharacter.cpp

void AFPSCharacter::StartPickUp()
{
	requestPickUp = true;	// LMB pressed
}

void AFPSCharacter::EndPickUp()
{
	requestPickUp = false; // LMB released
}

Is it possible to call OnOverlapBegin every frame when checkingPickUp is true?

void AFPSBall::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	if (checkingPickUp == true)
	{
		OnOverlapBegin; // ?????
	}
}

I think you should solved this by changing design of the code. Insted of remembering state of the mouse button and do action in OnOverlapBegin, try remembering state of overlap (change some bool on OnOverlapBegin and OnOverlapEnd) and do action on mouse button click.