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"

Can't assign camera to new created player


I've got problem with my code. What I'm trying to do here is to assign camera from the scene to a new created player. I'm doing it like this:

     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
     AActor* kamera;
     //APlayerController * rightScreen;
     for (TActorIterator<ACameraActor> Itr(GetWorld()); Itr; ++Itr)
         if (Itr->GetName() == "Kameraprawa")
             kamera = *Itr;
             GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, kamera->GetName());
             GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("Sorry, didn't found this camera"));
     //GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::Printf(TEXT("dodaje kamera graczowi z id: %d"),rightScreen->GetUniqueID()));
     UGameplayStatics::CreatePlayer(GetWorld(), 2, true)->SetViewTargetWithBlend(kamera);

It's compiling and I can go to editor to check, and in editor: The name of kamera is debuging so I assume it's correctly referenced. But SetViewTargetWithBlend seems to work on new player AND the old one. The worst thing is I don't get view from camera I selected but only a black screen on both split screens. I'd got CreatePlayer separated from SetViewTargetWithBlend but this didn't seem to give any effect.

Had anyone something like this, or can help with it?

Regards, Michael

P.S. I don't know if this information will help but this code is in GameMode of my map, in BeginPlay event.

Product Version: UE 4.9
more ▼

asked Nov 11 '15 at 06:20 PM in C++ Programming

avatar image

3 4 6

avatar image Hohel Nov 12 '15 at 04:08 PM

Bump, can anyone help?

(comments are locked)
10|2000 characters needed characters left

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