p.NetMoveCombiningAttachedRotationTolerance

p.NetMoveCombiningAttachedRotationTolerance

#Overview

name: p.NetMoveCombiningAttachedRotationTolerance

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.NetMoveCombiningAttachedRotationTolerance is to set a tolerance threshold for relative rotation changes when combining network moves for character movement in Unreal Engine 5. This setting is specifically used in the character movement system to handle network replication and movement prediction.

This setting variable is primarily used by the Character Movement Component, which is part of the Engine module in Unreal Engine 5. It is specifically utilized in the network movement and prediction system for characters.

The value of this variable is set through the Unreal Engine console variable system. It is initialized with a default value of 0.01f and can be modified at runtime using console commands or through game code.

The associated variable NetMoveCombiningAttachedRotationTolerance directly interacts with p.NetMoveCombiningAttachedRotationTolerance. They share the same value, with the console variable (p.NetMoveCombiningAttachedRotationTolerance) controlling the value of the static variable (NetMoveCombiningAttachedRotationTolerance).

Developers must be aware that this variable affects the precision of movement replication for characters, particularly when they are attached to other objects. A smaller tolerance value will result in more precise movement replication but may increase network traffic and processing overhead. Conversely, a larger value can reduce network traffic but may introduce slight visual discrepancies in character movement.

Best practices when using this variable include:

  1. Carefully balance between precision and performance based on the specific needs of your game.
  2. Test thoroughly with various network conditions to ensure smooth character movement.
  3. Consider adjusting this value if you notice jerky movement or excessive network traffic related to character movement.
  4. Use in conjunction with other network-related settings for optimal results.

Regarding the associated variable NetMoveCombiningAttachedRotationTolerance: This static variable is used directly in the character movement code, specifically in the FSavedMove_Character::CanCombineWith function. It determines whether two movement updates can be combined based on the relative rotation change of attached objects. The variable is accessed through the CharacterMovementCVars namespace, allowing for easy reference throughout the character movement component code.

#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:186

Scope (from outer to inner):

file
namespace    CharacterMovementCVars

Source code excerpt:

	static float NetMoveCombiningAttachedRotationTolerance = 0.01f;
	FAutoConsoleVariableRef CVarNetMoveCombiningAttachedRotationTolerance(
		TEXT("p.NetMoveCombiningAttachedRotationTolerance"),
		NetMoveCombiningAttachedRotationTolerance,
		TEXT("Tolerance for relative rotation attachment change when combining moves. Small tolerances allow for very slight jitter due to transform updates."),
		ECVF_Default);

	static float NetStationaryRotationTolerance = 0.1f;
	FAutoConsoleVariableRef CVarNetStationaryRotationTolerance(

#Associated Variable and Callsites

This variable is associated with another variable named NetMoveCombiningAttachedRotationTolerance. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:184

Scope (from outer to inner):

file
namespace    CharacterMovementCVars

Source code excerpt:

		ECVF_Default);

	static float NetMoveCombiningAttachedRotationTolerance = 0.01f;
	FAutoConsoleVariableRef CVarNetMoveCombiningAttachedRotationTolerance(
		TEXT("p.NetMoveCombiningAttachedRotationTolerance"),
		NetMoveCombiningAttachedRotationTolerance,
		TEXT("Tolerance for relative rotation attachment change when combining moves. Small tolerances allow for very slight jitter due to transform updates."),
		ECVF_Default);

	static float NetStationaryRotationTolerance = 0.1f;
	FAutoConsoleVariableRef CVarNetStationaryRotationTolerance(
		TEXT("p.NetStationaryRotationTolerance"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:12617

Scope (from outer to inner):

file
function     bool FSavedMove_Character::CanCombineWith

Source code excerpt:

		FRotator RelativeRotationDelta = StartAttachRelativeRotation - NewMove->StartAttachRelativeRotation;
		RelativeRotationDelta.Yaw = 0.0f;
		if (!RelativeRotationDelta.IsNearlyZero(CharacterMovementCVars::NetMoveCombiningAttachedRotationTolerance))
		{
			return false;
		}
	}
	else
	{