p.GeometryCollectionRepAngularMatchTime

p.GeometryCollectionRepAngularMatchTime

#Overview

name: p.GeometryCollectionRepAngularMatchTime

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.GeometryCollectionRepAngularMatchTime is to control the speed at which the angle of a Geometry Collection component matches its replicated target angle during network replication. This setting is part of the Geometry Collection system, which is used for handling complex, breakable objects in Unreal Engine 5.

This setting variable is primarily used in the Geometry Collection Engine module, specifically within the GeometryCollectionComponent.cpp file. It’s part of the replication system for Geometry Collections, which is crucial for maintaining consistency in networked multiplayer games.

The value of this variable is set to a default of 0.5 seconds in the source code. It’s defined as a console variable, which means it can be adjusted at runtime through the console or configuration files.

The associated variable GeometryCollectionRepAngularMatchTime directly interacts with p.GeometryCollectionRepAngularMatchTime. They share the same value and purpose.

Developers must be aware that this variable affects the smoothness of angular rotations for replicated Geometry Collections. A lower value will result in quicker angular matching, while a higher value will lead to smoother but slower matching.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your game’s networking requirements.
  2. Testing with different values to find the right balance between responsiveness and smoothness.
  3. Considering the impact on network bandwidth and client-side prediction.

Regarding the associated variable GeometryCollectionRepAngularMatchTime:

The purpose of GeometryCollectionRepAngularMatchTime is identical to p.GeometryCollectionRepAngularMatchTime. It’s used internally within the engine code to actually apply the setting.

This variable is used directly in the UpdateClusterPositionAndVelocitiesFromReplication function, which is responsible for updating the position and velocities of Geometry Collection clusters based on replicated data.

The value of this variable is set by the console variable p.GeometryCollectionRepAngularMatchTime.

It interacts closely with other replication-related variables like GeometryCollectionRepMaxExtrapolationTime and is used in calculations involving angular velocities and rotations.

Developers should be aware that modifying this variable directly in code is not recommended. Instead, they should use the console variable p.GeometryCollectionRepAngularMatchTime to adjust the behavior.

Best practices include using this variable in conjunction with other replication settings to achieve the desired network behavior for Geometry Collections, and thoroughly testing any changes to ensure they don’t negatively impact gameplay or network performance.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:2494

Scope: file

Source code excerpt:


float GeometryCollectionRepAngularMatchTime = .5f;
FAutoConsoleVariableRef CVarGeometryCollectionRepAngularMatchTime(TEXT("p.GeometryCollectionRepAngularMatchTime"), GeometryCollectionRepAngularMatchTime, TEXT("In seconds, how quickly should the angle match the replicated target angle"));

float GeometryCollectionRepMaxExtrapolationTime = 3.f;
FAutoConsoleVariableRef CVarGeometryCollectionRepMaxExtrapolationTime(TEXT("p.GeometryCollectionRepMaxExtrapolationTime"), GeometryCollectionRepMaxExtrapolationTime, TEXT("Number of seconds that replicated physics data will persist for a GC, extrapolating velocities"));

bool bGeometryCollectionDebugDrawRep = 0;
FAutoConsoleVariableRef CVarGeometryCollectionDebugDrawRep(TEXT("p.Chaos.DebugDraw.GeometryCollectionReplication"), bGeometryCollectionDebugDrawRep,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:2493

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarGeometryCollectionRepLinearMatchStrength(TEXT("p.GeometryCollectionRepLinearMatchStrength"), GeometryCollectionRepLinearMatchStrength, TEXT("Units can be interpreted as %/s^2 - acceleration of percent linear correction"));

float GeometryCollectionRepAngularMatchTime = .5f;
FAutoConsoleVariableRef CVarGeometryCollectionRepAngularMatchTime(TEXT("p.GeometryCollectionRepAngularMatchTime"), GeometryCollectionRepAngularMatchTime, TEXT("In seconds, how quickly should the angle match the replicated target angle"));

float GeometryCollectionRepMaxExtrapolationTime = 3.f;
FAutoConsoleVariableRef CVarGeometryCollectionRepMaxExtrapolationTime(TEXT("p.GeometryCollectionRepMaxExtrapolationTime"), GeometryCollectionRepMaxExtrapolationTime, TEXT("Number of seconds that replicated physics data will persist for a GC, extrapolating velocities"));

bool bGeometryCollectionDebugDrawRep = 0;
FAutoConsoleVariableRef CVarGeometryCollectionDebugDrawRep(TEXT("p.Chaos.DebugDraw.GeometryCollectionReplication"), bGeometryCollectionDebugDrawRep,

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:2636

Scope (from outer to inner):

file
namespace    anonymous
function     bool UpdateClusterPositionAndVelocitiesFromReplication

Source code excerpt:

			const FVector RepAngVel = AngularVelocity;
			const Chaos::FRotation3 RepExtrapAng = Chaos::FRotation3::IntegrateRotationWithAngularVelocity(Rotation, RepAngVel, RepExtrapTime);
			const FVector AngVel = Chaos::FRotation3::CalculateAngularVelocity(Cluster.GetR(), RepExtrapAng, GeometryCollectionRepAngularMatchTime);
			if (AngVel.SizeSquared() > SMALL_NUMBER)
			{
				Cluster.SetW(RepAngVel + AngVel);
				bWake = true;
			}
		}