x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

function arguments within AddDynamic() call

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 (docs.unrealengine.com/latest/INT/Programming/Tutorials/AutoCamera) 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.

Product Version: UE 4.14
Tags:
more ▼

asked Feb 10 '17 at 11:00 PM in C++ Programming

avatar image

Kooma25
1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question