Camera fov based on viewport size?

Hi, so i have always struggled with camera size part and what it can see based on viewport size. Some games i have played fits (give or take) anything from down to top/fit to screen hight. With unreal it fits (give or take) from left to right/fit to screen widght

How do i change that?

Usually the FOV is set between 70 and 85 for regular FPS gameplay, but for cinematic effects or close up face shots even an FOV of 30 can be desired. What I mean is the desired FOV is not directly related to the screen width. However, some FOV values which are too big can cause warping on screens which are not wide.

I have not tried a very wide screen myself but, don’t high values of FOV only make sense on curved screens?

You can set the FOV from a PlayerCameraManager, accessible from any PlayerController.
You can the viewport size from APlayerController::GetViewportSize().

By default unreal constrain FOV to horizontal viewport width but this behaviour can be changed.

Variable can be changed from c++. I usually do it in Player Controller constructor

AHazardPlayerController::AHazardPlayerController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
    //HACK HACK 
    ULocalPlayer* DefaultLocalPlayer = ULocalPlayer::StaticClass()->GetDefaultObject<ULocalPlayer>();
    DefaultLocalPlayer->AspectRatioAxisConstraint = AspectRatio_MaintainYFOV;

Or you can add


to DefaultEngine.ini


Thanks, worked but had change a little thing

AspectRatioAxisConstraint = AspectRatio_MaintainYFOV

Thanks, I corrected the answer.