I have a Tmap called CameraSetups and I’m trying to bind a Delegate (OnTriggerEnterDel) that was referred to in the Value to a function that would take a CameraActor as an argument. The CameraActor should be the respective Key to the Value but I can’t seem to find a way to pass this argument to the function.
for (auto& Elem : CameraSetups)
{
// I need to somehow pass in the paired key to the function MoveToCamera
Elem.Value->OnTriggerEnterDel.AddDynamic(this,&ACameraDirector::MoveToCamera);
}
void ACameraDirector::MoveToCamera(AActor* Camera)
{
if (OurPlayerController)
{
if ((OurPlayerController->GetViewTarget() != Camera) && (Camera != nullptr))
{
// Blend smoothly to camera
OurPlayerController->SetViewTargetWithBlend(Camera, SmoothBlendTime);
}
}
}
I am trying to modify CameraDirector that was presented in (Quick Start Guide to Implementing Automatic Camera Control in Unreal Engine CPP | Unreal Engine 5.1 Documentation) in such way that I would control the cameras using simple trigger volumes that broadcast a dynamic multicast delegate when a character overlaps the volume.
I was trying to use Tmap container to map references from the trigger volumes to their respective Camera actors that should then be transitioned to.
So I would like to know how to pass the argument within the AddDynamic() call.
I’m probably missing something here so some alternative approach suggestions are welcome.
Now I know that I can pass arguments through the broadcast in the TriggerVolume but I would like to keep the TriggerVolumes away from the tasks of the CameraDirector as much as possible.