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:
But how can I achieve exactly that in C++ with the player controller?