How to use vertical FOV using Blueprints

Hi,

Camera settings only provide a way to change the horizontal fov :

98236-ue4_horizontalfov_1.jpg

Same in Blueprint :

98237-ue4_horizontalfov_2.jpg

How can we force vertical FOV ?

Thanks

Use this to lock it to vertical (the wider the monitor the more you see to the sides (like it should be)).

-Remember to use degrees not radians.

-Put it to the Tick function to make sure it updates if the viewport is changed.

5 Likes

Thank you ! Just great :slight_smile:

Works like a charm. GG

Just keep in mind that “Make Literal float” is a VERTICAL VALUE - for FOV 90, this value will be 59. The calculator is at Horizontal/Vertical FOV Calculator

C++ Version:

int x, y;
World->GetFirstPlayerController()->GetViewportSize(x, y);
Camera->FieldOfView = FMath::RadiansToDegrees(2 * FMath::Atan(FMath::Tan(FMath::DegreesToRadians(Camera->FieldOfView) / 2) * x / y));
1 Like

Can I get a version of this, but to lock the horizontal FOV? Thanks! :slight_smile:

Horizontal field of view works in the engine by default/

I don’t think calculating and setting FOV in every tick is a good way.
You should try following INI setting.

[/Script/Engine.LocalPlayer]
AspectRatioAxisConstraint=AspectRatio_MaintainYFOV

3 Likes

Or you can Call GetLocalPlayer()->AspectRatioAxisConstraint = EAspectRatioAxisConstraint::AspectRatio_MaintainYFOV;

1 Like