Currently I’m using:
void AMainCharacterTesting::OnComponentBeginOverlap(AActor* OtherActor /*Rest removed cause hard to read*/)
{
if (ATargetDummy* TargetDummyCheck = Cast<ATargetDummy>(OtherActor))
{
if (TargetDummyCheck->bIsTargetable)
{
LockOnCandidates.AddUnique(OtherActor);
}
}
}
void AMainCharacterTesting::OnComponentEndOverlap(AActor* OtherActor /*Rest removed cause hard to read*/)
{
if (ATargetDummy* TargetDummyCheck = Cast<ATargetDummy>(OtherActor))
{
LockOnCandidates.Remove(OtherActor);
}
}
This is for a box collision component that is attached to the spring arm component and follows its location and rotation. Currently it works but I have a few problems with it cause when I want to detect if a pawn is overlapping with the box collision and I move out of range of the collision and move my camera so that the collision is in range the overlap events don’t run unless my character has moved.
Here’s a video showing this: