bEnableFOVScaling

bEnableFOVScaling

#Overview

name: bEnableFOVScaling

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bEnableFOVScaling is to control whether the mouse input sensitivity should be adjusted based on the player’s field of view (FOV). This setting is primarily used in the input system to enhance aiming accuracy and consistency across different FOV settings.

This setting variable is relied upon by the Unreal Engine’s input system, specifically within the PlayerInput module. It’s also utilized in game-specific features such as aim assist systems, as seen in the ShooterCore plugin of the Lyra project.

The value of this variable is set in the InputSettings class, which is a config property. This means it can be configured in the project settings or through engine configuration files.

bEnableFOVScaling interacts with other variables, particularly:

  1. FOVScale: Used to calculate the scaling factor when bEnableFOVScaling is enabled.
  2. PlayerCameraManager’s FOVAngle: The current FOV angle is used in the calculation when scaling is enabled.

Developers must be aware that enabling this setting will cause mouse sensitivity to change dynamically based on the player’s current FOV. This can affect player aim and overall feel of mouse control, especially in first-person or third-person shooter games where precise aiming is crucial.

Best practices when using this variable include:

  1. Carefully consider whether FOV scaling is appropriate for your game genre and target audience.
  2. If enabled, ensure that the FOVScale value is properly tuned to maintain a consistent feel across different FOV settings.
  3. Provide options for players to enable/disable this feature, as some players may prefer consistent mouse sensitivity regardless of FOV.
  4. Test thoroughly with various FOV settings to ensure that the scaling feels natural and doesn’t negatively impact gameplay.
  5. Consider how this setting interacts with other input-related features, such as aim assist or input smoothing.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseInput.ini:6, section: [/Script/Engine.InputSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/InputSettings.h:51

Scope (from outer to inner):

file
class        class UInputSettings : public UObject

Source code excerpt:

	// Scale the mouse based on the player camera manager's field of view
	UPROPERTY(config, EditAnywhere, Category="MouseProperties", AdvancedDisplay)
	uint8 bEnableFOVScaling:1;

	/** Controls if the viewport will capture the mouse on Launch of the application */
	UPROPERTY(config, EditAnywhere, Category = "ViewportProperties")
	uint8 bCaptureMouseOnLaunch:1;

	/** Enable the use of legacy input scales on the player controller (InputYawScale, InputPitchScale, and InputRollScale) */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/PlayerInput.cpp:2029

Scope (from outer to inner):

file
function     float UPlayerInput::MassageAxisInput

Source code excerpt:

		// Take FOV into account (lower FOV == less sensitivity).
		APlayerController const* const PlayerController = GetOuterAPlayerController();
		float const FOVScale = (DefaultInputSettings->bEnableFOVScaling && PlayerController && PlayerController->PlayerCameraManager) ? (DefaultInputSettings->FOVScale*PlayerController->PlayerCameraManager->GetFOVAngle()) : 1.0f;
		NewVal *= FOVScale;

		// debug
		if (Key == EKeys::MouseX)
		{
			DebugUnSmoothedMouseX += NewVal * DebugSmoothedMouseSensitivity;

#Loc: <Workspace>/Projects/Lyra/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Input/AimAssistTargetManagerComponent.cpp:351

Scope (from outer to inner):

file
function     float UAimAssistTargetManagerComponent::GetFOVScale

Source code excerpt:

	check(DefaultInputSettings && PC);

	if (PC->PlayerCameraManager && DefaultInputSettings->bEnableFOVScaling)
	{
		const float FOVAngle = PC->PlayerCameraManager->GetFOVAngle();
		switch (InputType)
		{
		case ECommonInputType::Gamepad:
		case ECommonInputType::Touch: