Tuesday, June 14, 2016

C++ Unreal Engine 4 -> Adjust Field of View Camera

This simple function will change your FOV in UE4 in your code. Field of View is the camera's viewport of how much you want to include in your view. The lower the FOV the more magnified everything will appear to be, the higher, it'll show more in the viewport.

This function takes one parameter float x which is the FOV value:

float AGameController::ToggleCamera(float x) {
    FString str = FString::SanitizeFloat(x);
        APlayerController* PController= UGameplayStatics::GetPlayerController(GetWorld(), 0);
        PController->ConsoleCommand(TEXT("fov " + str), true);
    return x;


No comments:

Post a Comment