ForceFeedbackScale
ForceFeedbackScale
#Overview
name: ForceFeedbackScale
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ForceFeedbackScale is to adjust the intensity of force feedback effects in the game. It is used as a multiplier to scale the force feedback values for both large and small motors on the left and right sides of a game controller.
This setting variable is primarily used by the PlayerController subsystem within the Unreal Engine’s core gameplay framework. It is part of the input handling and feedback system, specifically for force feedback (also known as haptic feedback or rumble) in game controllers.
The value of this variable is initially set in the PlayerController constructor to 1.0f, which means no scaling by default. It can be modified through configuration files or at runtime via C++ or Blueprint.
ForceFeedbackScale interacts directly with the ForceFeedbackValues struct, which contains separate values for LeftLarge, RightLarge, LeftSmall, and RightSmall motors. These values are multiplied by ForceFeedbackScale and then clamped between 0 and 1 to ensure they remain within the valid range.
Developers must be aware that this variable affects all force feedback effects globally for a specific player controller. It’s important to consider how changing this value might impact the player’s experience across different parts of the game.
Best practices when using this variable include:
- Use it to allow players to adjust force feedback intensity in game settings.
- Consider platform-specific differences in force feedback capabilities when setting this value.
- Be cautious about changing it frequently during gameplay, as it might lead to inconsistent feedback experiences.
- Test force feedback with various scale values to ensure effects remain noticeable but not overwhelming.
- Remember that some players may prefer to disable force feedback entirely, so always provide an option to set this to 0.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:172, section: [/Script/Engine.PlayerController]
- INI Section:
/Script/Engine.PlayerController
- Raw value:
1.0
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:12, section: [/Script/LyraGame.LyraPlayerController]
- INI Section:
/Script/LyraGame.LyraPlayerController
- Raw value:
1.0
- 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/PlayerController.h:604
Scope (from outer to inner):
file
class class APlayerController : public AController, public IWorldPartitionStreamingSourceProvider
Source code excerpt:
/** Scale applied to force feedback values */
UPROPERTY(config)
float ForceFeedbackScale;
/** List of keys that will cause click events to be forwarded, default to left click */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=MouseInterface, meta=(EditCondition="bEnableClickEvents"))
TArray<FKey> ClickEventKeys;
/** Type of mouse cursor to show by default */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:211
Scope (from outer to inner):
file
function APlayerController::APlayerController
Source code excerpt:
bEnableTouchEvents = true;
bForceFeedbackEnabled = true;
ForceFeedbackScale = 1.f;
// default to true; won't do anything if enable motion controls in input settings isn't also true
SetMotionControlsEnabled(true);
bEnableStreamingSource = true;
bStreamingSourceShouldActivate = true;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:4641
Scope (from outer to inner):
file
function void APlayerController::ProcessForceFeedbackAndHaptics
Source code excerpt:
}
// Apply ForceFeedbackScale
ForceFeedbackValues.LeftLarge = FMath::Clamp(ForceFeedbackValues.LeftLarge * ForceFeedbackScale, 0.f, 1.f);
ForceFeedbackValues.RightLarge = FMath::Clamp(ForceFeedbackValues.RightLarge * ForceFeedbackScale, 0.f, 1.f);
ForceFeedbackValues.LeftSmall = FMath::Clamp(ForceFeedbackValues.LeftSmall * ForceFeedbackScale, 0.f, 1.f);
ForceFeedbackValues.RightSmall = FMath::Clamp(ForceFeedbackValues.RightSmall * ForceFeedbackScale, 0.f, 1.f);
// --- Haptic Feedback -------------------------
if (bProcessDynamicFeedback)
{
if (ActiveHapticEffect_Left.IsValid())
{