AsyncFixedTimeStepSize
AsyncFixedTimeStepSize
#Overview
name: AsyncFixedTimeStepSize
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AsyncFixedTimeStepSize is to define the time step size for asynchronous physics simulation in Unreal Engine 5. It is used when the physics system is configured to run asynchronously.
This setting variable is primarily used by the physics engine subsystem within Unreal Engine 5. Based on the callsites, it is specifically utilized in the PhysicsSettings class and the Chaos physics system.
The value of this variable is set in the UPhysicsSettings constructor with a default value of 1/30th of a second (approximately 0.0333 seconds). It can be modified through the Unreal Engine editor in the Physics Settings under the Framerate category.
AsyncFixedTimeStepSize interacts with other physics-related variables, such as bTickPhysicsAsync, which determines whether async physics is enabled. It also influences the GetPhysicsHistoryCount() function, which calculates the number of physics history frames based on this time step size.
Developers must be aware that this feature is experimental, as indicated by the comment in the source code. Certain functionality might not work correctly when using async physics with this fixed time step.
Best practices when using this variable include:
- Only enable it (by setting bTickPhysicsAsync to true) if you specifically need async physics simulation.
- Be cautious when modifying the default value, as it may affect physics simulation stability and performance.
- Test thoroughly when enabling async physics, as it may introduce unexpected behavior in your game.
- Consider the relationship between this value and other physics settings like MaxSubstepDeltaTime and MaxSubsteps to ensure consistent and stable physics simulation.
- Monitor performance and adjust the value if needed, keeping in mind that smaller time steps may increase accuracy but also increase computational cost.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:341, section: [/Script/Engine.PhysicsSettings]
- INI Section:
/Script/Engine.PhysicsSettings
- Raw value:
0.033333
- 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/PhysicsEngine/PhysicsSettings.h:217
Scope (from outer to inner):
file
class class UPhysicsSettings : public UPhysicsSettingsCore
Source code excerpt:
/** If using async, the time step size to tick at. This feature is still experimental. Certain functionality might not work correctly*/
UPROPERTY(config, EditAnywhere, Category = Framerate, meta=(editcondition = "bTickPhysicsAsync"))
float AsyncFixedTimeStepSize;
/** Max delta time (in seconds) for an individual simulation substep. */
UPROPERTY(config, EditAnywhere, meta = (ClampMin = "0.0013", UIMin = "0.0013", ClampMax = "1.0", UIMax = "1.0", editcondition = "bSubStepping"), Category=Framerate)
float MaxSubstepDeltaTime;
/** Max number of substeps for physics simulation. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/PhysicsEngine/PhysicsSettings.h:262
Scope (from outer to inner):
file
class class UPhysicsSettings : public UPhysicsSettingsCore
function int32 GetPhysicsHistoryCount
Source code excerpt:
int32 GetPhysicsHistoryCount() const
{
return FMath::Max<int32>(1, FMath::CeilToInt(0.001f * PhysicsPrediction.MaxSupportedLatencyPrediction / AsyncFixedTimeStepSize));
}
ENGINE_API virtual void PostInitProperties() override;
#if WITH_EDITOR
ENGINE_API virtual bool CanEditChange( const FProperty* Property ) const override;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:519
Scope: file
Source code excerpt:
)
: Super(InSolverActor ? InSolverActor->GetWorld() : nullptr
, UPhysicsSettings::Get()->bTickPhysicsAsync ? UPhysicsSettings::Get()->AsyncFixedTimeStepSize : -1
#if CHAOS_DEBUG_NAME
, DebugName
#endif
)
, PhysicsReplication(nullptr)
, SolverActor(InSolverActor)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/PhysicsSettings.cpp:22
Scope (from outer to inner):
file
function UPhysicsSettings::UPhysicsSettings
Source code excerpt:
, bSubstepping(false)
, bTickPhysicsAsync(false)
, AsyncFixedTimeStepSize(1.f / 30.f)
, MaxSubstepDeltaTime(1.f / 60.f)
, MaxSubsteps(6)
, SyncSceneSmoothingFactor(0.0f)
, InitialAverageFrameRate(1.f / 60.f)
, PhysXTreeRebuildRate(10)
, MinDeltaVelocityForHitEvents(0.f)