How to control a camera directly from the player controller?

I want to override the CalcCamera() method in my custom player controller class, so that I can set the camera’s location and rotation directly from my code.
Code:

void ATycoonPlayerController::BeginPlay()
{
    SetViewTarget(this);
}

void ATycoonPlayerController::CalcCamera(float DeltaTime, FMinimalViewInfo& OutResult)
{
    const FVector camLoc(-270.0f, 270.0f, 400.0f);
    const FRotator camRot(0.0f, -70.0f, 0.0f);

    OutResult.Location = camLoc;
    OutResult.Rotation = camRot;
    OutResult.FOV = 90.0f;
}

However, that does not change the camera’s location nor rotation.
Am I missing something?

For the records, when I create a custom Blueprint class deriving from PlayerCameraManager and do the following in the “Blueprint Update Camera” function, then it works:

253938-capture.png

But how can I achieve exactly that in C++ with the player controller?

Hello Haimat,

Can you please provide me with your full class ATycoonPlayerController.cpp, and .h file?

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.

Thanks!