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"

How to use APlayerCameraManager::StartCameraFade

Hello Everyone,

I am trying to fade my camera in at the start of the game. I took a look at the documentation and came across the function: APlayerCameraManager::StartCameraFade();

However, I have no Idea how I call this function within a script.

I want to do this on the player from the FirstPersonTemplate

I added a C++ Component to this player and so far I tried: void UTestingTransform::BeginPlay() { Super::BeginPlay();

             //This didnt work
         if (GetWorld())
         {
             cameraManager = Cast<APlayerCameraManager>(GetClass());
     
             if (cameraManager)
             {
                 UE_LOG(LogTemp, Error, TEXT("SUCCES"));
             }
             else
             {
                 UE_LOG(LogTemp, Error, TEXT("FAILURE"));
             }
         }
     
             //Neither did this
             GetOwner()->FindComponentByClass<APlayerCameraManager>();
     }


I understand that the class is childclass of AActor. However, I can't figure it out.

Perhaps someone can put me on the right track or provide me with an exampe?

Greetings,

Kyle

Product Version: UE 4.15
Tags:
more ▼

asked May 09 '17 at 11:00 AM in C++ Programming

avatar image

smoothy101
1 1 4

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

2 answers: sort voted first

APlayerCameraManager * a = UGameplayStatics::GetPlayerCameraManager(GetWorld(), 0);

if (a) { a->StartCameraFade(1, 0, 0.5, FLinearColor::Black, false, true); }

more ▼

answered Aug 28 '18 at 03:45 PM

avatar image

mseeds1
0 2 3

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

Your PlayerController creates an instance of the PlayerCameraManager class on play. You can access the PlayerCameraManager through your PlayerController.

From the PlayerController:

 if(PlayerCameraManager != nullptr)
 {
     PlayerCameraManager->StartCameraFade(1.f, 0.f, 1.f, FLinearColor::Black, true, true);
 }

Or from the Pawn/ Character

 if(APlayerController* PC = Cast<APlayerController>(GetController()))
 {
     if(PC->PlayerCameraManager)
     {
         PC->PlayerCameraManager->StartCameraFade(1.f, 0.f, 1.f, FLinearColor::Black, true, true);
     }
 }


If you want to fade the camera in on start, then do this in the BeginPlay function.

more ▼

answered Aug 29 '18 at 06:54 PM

avatar image

MazyModz
266 4 5 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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