bTickPhysicsAsync
bTickPhysicsAsync
#Overview
name: bTickPhysicsAsync
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 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bTickPhysicsAsync is to control whether physics simulation should be executed on an asynchronous thread in Unreal Engine 5. This setting is part of the physics system configuration and affects how physics calculations are processed in relation to the main game loop.
This setting variable is primarily used by the physics engine subsystem within Unreal Engine 5. Based on the callsites, it is referenced in the PhysicsSettings class and the PhysScene_Chaos implementation, which are core components of the engine’s physics system.
The value of this variable is set in the PhysicsSettings class, which is likely initialized when the engine starts up or when physics settings are loaded. It can be modified through the engine’s configuration system, as indicated by the ‘config’ specifier in the UPROPERTY macro.
bTickPhysicsAsync interacts closely with the AsyncFixedTimeStepSize variable. When bTickPhysicsAsync is true, AsyncFixedTimeStepSize determines the fixed time step size for the asynchronous physics simulation.
Developers must be aware that this feature is experimental, as explicitly stated in the comments. Certain functionality might not work correctly when using async physics ticking. This implies that thorough testing is necessary when enabling this feature.
Best practices when using this variable include:
- Only enable it if you have a specific need for asynchronous physics simulation.
- Thoroughly test your game’s physics interactions when this setting is enabled.
- Pay attention to the AsyncFixedTimeStepSize and adjust it as needed for your game’s requirements.
- Be prepared to handle potential inconsistencies or unexpected behavior in physics simulations.
- Keep track of performance implications, as async physics might affect CPU usage and frame rates differently than synchronous physics.
- Consider gradually introducing this feature in a controlled environment before applying it to the entire game.
Remember that as an experimental feature, it may be subject to changes or improvements in future engine updates.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:340, section: [/Script/Engine.PhysicsSettings]
- INI Section:
/Script/Engine.PhysicsSettings
- Raw value:
False
- 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:213
Scope (from outer to inner):
file
class class UPhysicsSettings : public UPhysicsSettingsCore
Source code excerpt:
/** Whether to tick physics simulation on an async thread. This feature is still experimental. Certain functionality might not work correctly*/
UPROPERTY(config, EditAnywhere, Category = Framerate)
bool bTickPhysicsAsync;
/** 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. */
#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:21
Scope (from outer to inner):
file
function UPhysicsSettings::UPhysicsSettings
Source code excerpt:
, MaxPhysicsDeltaTime(1.f / 30.f)
, 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)