p.NetStationaryRotationTolerance
p.NetStationaryRotationTolerance
#Overview
name: p.NetStationaryRotationTolerance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Tolerance for GetClientNetSendDeltaTime() to remain throttled when small control rotation changes occur.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.NetStationaryRotationTolerance is to define a tolerance threshold for small control rotation changes in networked character movement. This setting is primarily used in the character movement system of Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the character movement component, specifically within the networking and replication aspects of character movement.
The value of this variable is set in the CharacterMovementComponent.cpp file, within the CharacterMovementCVars namespace. It is initialized with a default value of 0.1f and can be modified at runtime through the console variable system.
The associated variable NetStationaryRotationTolerance interacts directly with p.NetStationaryRotationTolerance. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the throttling behavior of GetClientNetSendDeltaTime(). It determines how sensitive the system is to small control rotation changes when deciding whether to send updates over the network.
Best practices when using this variable include:
- Carefully adjusting the value to balance between network performance and movement accuracy.
- Testing thoroughly in networked environments to ensure the chosen value doesn’t introduce noticeable lag or jerky movement.
- Considering the game’s specific requirements and gameplay style when fine-tuning this value.
Regarding the associated variable NetStationaryRotationTolerance:
- Its purpose is identical to p.NetStationaryRotationTolerance, serving as the actual variable used in the code.
- It is used within the FSavedMove_Character::IsMatchingStartControlRotation function to compare control rotations.
- The value is set through the console variable system, allowing for runtime adjustments.
- Developers should treat it as equivalent to p.NetStationaryRotationTolerance in terms of functionality and impact on the character movement system.
- When modifying this value, developers should consider its effects on network performance and movement fidelity, especially in multiplayer scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:193
Scope (from outer to inner):
file
namespace CharacterMovementCVars
Source code excerpt:
static float NetStationaryRotationTolerance = 0.1f;
FAutoConsoleVariableRef CVarNetStationaryRotationTolerance(
TEXT("p.NetStationaryRotationTolerance"),
NetStationaryRotationTolerance,
TEXT("Tolerance for GetClientNetSendDeltaTime() to remain throttled when small control rotation changes occur."),
ECVF_Default);
static int32 NetUseClientTimestampForReplicatedTransform = 1;
FAutoConsoleVariableRef CVarNetUseClientTimestampForReplicatedTransform(
#Associated Variable and Callsites
This variable is associated with another variable named NetStationaryRotationTolerance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:191
Scope (from outer to inner):
file
namespace CharacterMovementCVars
Source code excerpt:
ECVF_Default);
static float NetStationaryRotationTolerance = 0.1f;
FAutoConsoleVariableRef CVarNetStationaryRotationTolerance(
TEXT("p.NetStationaryRotationTolerance"),
NetStationaryRotationTolerance,
TEXT("Tolerance for GetClientNetSendDeltaTime() to remain throttled when small control rotation changes occur."),
ECVF_Default);
static int32 NetUseClientTimestampForReplicatedTransform = 1;
FAutoConsoleVariableRef CVarNetUseClientTimestampForReplicatedTransform(
TEXT("p.NetUseClientTimestampForReplicatedTransform"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:12453
Scope (from outer to inner):
file
function bool FSavedMove_Character::IsMatchingStartControlRotation
Source code excerpt:
bool FSavedMove_Character::IsMatchingStartControlRotation(const APlayerController* PC) const
{
return PC ? StartControlRotation.Equals(PC->GetControlRotation(), CharacterMovementCVars::NetStationaryRotationTolerance) : false;
}
void FSavedMove_Character::GetPackedAngles(uint32& YawAndPitchPack, uint8& RollPack) const
{
// Compress rotation down to 5 bytes
YawAndPitchPack = UCharacterMovementComponent::PackYawAndPitchTo32(SavedControlRotation.Yaw, SavedControlRotation.Pitch);