Calling a custom C++ function when entering a trigger box

I’m trying to call a custom function (called ‘SwapCameras’), defined in a separate object (called ‘CameraDirector’) when the character is entering a trigger box. I hope this is clear and no code snippets are needed.

Hello,

I would suggest utilizing the OnComponentBeginOverlap function.

[h]

//Overlap
    UFUNCTION( )
    void BeginOverlap(UPrimitiveComponent* OverlappedComponent, 
                                   AActor* OtherActor, 
                                   UPrimitiveComponent* OtherComp, 
                                   int32 OtherBodyIndex, 
                                   bool bFromSweep, 
                                   const FHitResult &SweepResult );

[cpp]

 AMyActor::AMyActor()
{
     Collider->OnComponentBeginOverlap.AddDynamic( this, &AMyActor::BeginOverlap );
}

void AMyActor::BeginOverlap(UPrimitiveComponent* OverlappedComponent, 
                                AActor* OtherActor, 
                                UPrimitiveComponent* OtherComp, 
                                int32 OtherBodyIndex, 
                                bool bFromSweep, 
                                const FHitResult &SweepResult )
{
   // Call Custom Function here
}

Thanks,
Daniel