p.SecondChannelDelay
p.SecondChannelDelay
#Overview
name: p.SecondChannelDelay
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.SecondChannelDelay is to set a delay for the second channel in the Chaos physics system of Unreal Engine 5. This variable is primarily used in the physics simulation and interpolation processes.
-
The Chaos physics system, which is part of Unreal Engine’s experimental features, relies on this setting variable. It’s specifically used in the ChaosResultsManager, which is responsible for managing and interpolating physics simulation results.
-
The value of this variable is initially set to 0.05f (50 milliseconds) in the ChaosResultsManager.cpp file. It’s exposed as a console variable, which means it can be adjusted at runtime through the console or configuration files.
-
The associated variable SecondChannelDelay interacts directly with p.SecondChannelDelay. They share the same value, with SecondChannelDelay being the actual variable used in the code, while p.SecondChannelDelay is the console variable name.
-
Developers must be aware that this variable affects the timing of the second channel in physics simulations. It introduces a delay between the first and second channels, which can impact the perceived smoothness of physics interactions, especially in networked or split-screen scenarios.
-
Best practices when using this variable include:
- Carefully adjusting the value based on the specific needs of the game or simulation.
- Testing thoroughly with different values to ensure desired physics behavior across various scenarios.
- Considering the impact on network synchronization if the game has multiplayer features.
- Documenting any changes made to this value for future reference and debugging.
Regarding the associated variable SecondChannelDelay:
The purpose of SecondChannelDelay is to store the actual delay value used in the Chaos physics calculations. It’s the implementation variable that corresponds to the console variable p.SecondChannelDelay.
-
This variable is used directly in the Chaos physics subsystem, particularly in the ChaosResultsManager and related interpolation calculations.
-
Its value is set through the console variable p.SecondChannelDelay, allowing for runtime adjustments.
-
It interacts with the PerChannelTimeDelay array, where it’s used to set the delay for the second channel.
-
Developers should be aware that changes to SecondChannelDelay will directly affect physics simulations, particularly the timing between the first and second channels.
-
Best practices include:
- Accessing this variable through the console variable p.SecondChannelDelay for consistency.
- Considering the implications of changing this value on physics behavior and performance.
- Using this variable in conjunction with other Chaos physics settings for optimal results.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Framework/ChaosResultsManager.cpp:264
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FRealSingle SecondChannelDelay = 0.05f;
FAutoConsoleVariableRef CVarSecondChannelDelay(TEXT("p.SecondChannelDelay"), SecondChannelDelay, TEXT(""));
int32 DefaultNumActiveChannels = 1;
FAutoConsoleVariableRef CVarNumActiveChannels(TEXT("p.NumActiveChannels"), DefaultNumActiveChannels, TEXT(""));
FChaosResultsManager::FChaosResultsManager(FChaosMarshallingManager& InMarshallingManager)
: MarshallingManager(InMarshallingManager)
#Associated Variable and Callsites
This variable is associated with another variable named SecondChannelDelay
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Programs/HeadlessChaos/Private/HeadlessChaosTestRewind.cpp:4357
Scope (from outer to inner):
file
namespace ChaosTest
function GTEST_TEST
lambda-function
Source code excerpt:
Time += GtDt;
const FReal InterpolatedTime0 = Time - SimDt * Solver->GetAsyncInterpolationMultiplier();
const FReal InterpolatedTime1 = InterpolatedTime0 - Chaos::SecondChannelDelay;
if (InterpolatedTime0 < 0)
{
//No movement yet
EXPECT_NEAR(Particle.X()[2], 0, 1e-2);
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Framework/ChaosResultsManager.cpp:263
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
}
FRealSingle SecondChannelDelay = 0.05f;
FAutoConsoleVariableRef CVarSecondChannelDelay(TEXT("p.SecondChannelDelay"), SecondChannelDelay, TEXT(""));
int32 DefaultNumActiveChannels = 1;
FAutoConsoleVariableRef CVarNumActiveChannels(TEXT("p.NumActiveChannels"), DefaultNumActiveChannels, TEXT(""));
FChaosResultsManager::FChaosResultsManager(FChaosMarshallingManager& InMarshallingManager)
: MarshallingManager(InMarshallingManager)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Framework/ChaosResultsManager.cpp:279
Scope (from outer to inner):
file
namespace Chaos
function FChaosResultsManager::FChaosResultsManager
Source code excerpt:
PerChannelTimeDelay.Add(0);
PerChannelTimeDelay.Add(SecondChannelDelay);
}
const FChaosInterpolationResults& FChaosResultsChannel::UpdateInterpAlpha_External(FReal ResultsTime, const FReal GlobalAlpha)
{
Results.Alpha = (float)GlobalAlpha; // LWC_TODO: Precision loss
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Framework/ChaosResultsManager.h:7
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
class FChaosMarshallingManager;
extern FRealSingle SecondChannelDelay;
extern int32 DefaultNumActiveChannels;
struct FChaosRigidInterpolationData
{
FDirtyRigidParticleData Prev;
FDirtyRigidParticleData Next;