I am a bit confused on this part of the learning curve if I want my AI to do something only if the player is in the collision box and not just another Actor. I have the current function:
void ANPCHouse1::OnOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (OtherActor && (OtherActor != this) && OtherComp)
{
CapsuleComponent->SetVisibility(true);
GetMesh()->SetVisibility(true);
}
}
void ANPCHouse1::OnOverlapEnd(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
if (OtherActor && (OtherActor != this) && OtherComp)
{
CapsuleComponent->SetVisibility(false);
GetMesh()->SetVisibility(false);
}
}
However these get triggered if the NPC detect another NPC or actor for that matter. How can I get an instance of the current player’s actor so it only runs if a player is in the collision box?