bEnableMouseSmoothing
bEnableMouseSmoothing
#Overview
name: bEnableMouseSmoothing
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 bEnableMouseSmoothing is to control mouse input smoothing in the Unreal Engine’s input system. This setting is used to enhance the user experience by reducing jitter and providing more fluid mouse movement in games.
This setting variable is primarily used by the Unreal Engine’s input system, specifically within the Engine module. It is referenced in the InputSettings class and utilized in the PlayerInput subsystem.
The value of this variable is set in the InputSettings class, which is part of the Engine’s configuration system. It is defined as a UPROPERTY with the ‘config’ specifier, meaning it can be modified through configuration files or the project settings in the Unreal Editor.
bEnableMouseSmoothing interacts with other variables in the PlayerInput system, such as SmoothedMouse and ZeroTime arrays, which are used in the mouse smoothing calculations.
Developers should be aware that enabling mouse smoothing can introduce a slight delay in mouse input, which may be noticeable in fast-paced games or those requiring precise aiming. It’s a trade-off between smooth movement and immediate responsiveness.
Best practices when using this variable include:
- Consider the game genre and target audience when deciding whether to enable mouse smoothing.
- Test the game with both enabled and disabled mouse smoothing to determine which provides the best user experience.
- Provide an in-game option for players to toggle mouse smoothing, as some players may prefer raw input.
- When debugging input-related issues, check the state of this variable, as it can affect mouse behavior significantly.
- Be cautious when modifying this setting during runtime, as it may cause sudden changes in mouse behavior that could confuse players.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseInput.ini:5, section: [/Script/Engine.InputSettings]
- INI Section:
/Script/Engine.InputSettings
- Raw value:
true
- Is Array:
False
#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:47
Scope (from outer to inner):
file
class class UInputSettings : public UObject
Source code excerpt:
// Mouse smoothing control
UPROPERTY(config, EditAnywhere, Category="MouseProperties", AdvancedDisplay)
uint8 bEnableMouseSmoothing:1;
// 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 */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/PlayerInput.cpp:1756
Scope (from outer to inner):
file
function void UPlayerInput::DisplayDebug
Source code excerpt:
DisplayDebugManager.DrawString(FString::Printf(TEXT("MouseY ZeroTime: %.2f, Smoothed: %.2f"), ZeroTime[1], SmoothedMouse[1]));
if ( (ZeroTime[0] > 2.f && ZeroTime[1] > 2.f) && GetDefault<UInputSettings>()->bEnableMouseSmoothing )
{
// return to center of screen
DebugSmoothedMouseX = DebugUnSmoothedMouseX = Canvas->SizeX * 0.5f;
DebugSmoothedMouseY = DebugUnSmoothedMouseY = Canvas->SizeY * 0.5f;
}
else
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/PlayerInput.cpp:2043
Scope (from outer to inner):
file
function float UPlayerInput::MassageAxisInput
Source code excerpt:
// mouse smoothing
if (DefaultInputSettings->bEnableMouseSmoothing)
{
FKeyState* const KeyState = KeyStateMap.Find(Key);
if (KeyState)
{
NewVal = SmoothMouse( NewVal, KeyState->SampleCountAccumulator, (Key == EKeys::MouseX ? 0 : 1) );
}