ChaosSettings
ChaosSettings
#Overview
name: ChaosSettings
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 ChaosSettings is to manage and configure the Chaos physics engine settings within Unreal Engine 5. This variable is part of the physics system and specifically relates to the Chaos physics engine, which is the newer physics solution in Unreal Engine.
The ChaosSettings variable is primarily used in the Engine module, particularly within the PhysicsEngine subsystem. It is a member of the UPhysicsSettings class, which is derived from UPhysicsSettingsCore.
The value of this variable is set through the Unreal Engine project settings interface. It is defined as an UPROPERTY with the ‘config’ and ‘EditAnywhere’ specifiers, allowing it to be edited in the project settings and saved to configuration files.
ChaosSettings interacts with other physics-related variables and systems. For example, it affects the DefaultThreadingModel for Chaos physics simulations.
Developers should be aware of the following when using this variable:
- Changes to ChaosSettings trigger the OnSettingsUpdated() function, which may have cascading effects on the physics simulation.
- The DefaultThreadingModel is overridden to use TaskGraph if it’s set to DedicatedThread, as the dedicated thread mode is not fully supported with the world physics system.
Best practices when using this variable include:
- Modifying ChaosSettings through the project settings interface rather than directly in code to ensure proper propagation of changes.
- Being cautious when changing threading models, as it can significantly impact performance and behavior of the physics simulation.
- Testing thoroughly after making changes to ChaosSettings, as they can have wide-ranging effects on the game’s physics behavior.
- Considering the implications on both runtime performance and physics accuracy when adjusting these settings.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:352, section: [/Script/Engine.PhysicsSettings]
- INI Section:
/Script/Engine.PhysicsSettings
- Raw value:
(DefaultThreadingModel=TaskGraph,DedicatedThreadTickMode=VariableCappedWithTarget,DedicatedThreadBufferMode=Double)
- 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:253
Scope (from outer to inner):
file
class class UPhysicsSettings : public UPhysicsSettingsCore
Source code excerpt:
/** Chaos physics engine settings */
UPROPERTY(config, EditAnywhere, Category = ChaosPhysics)
FChaosPhysicsSettings ChaosSettings;
public:
static UPhysicsSettings* Get() { return CastChecked<UPhysicsSettings>(UPhysicsSettings::StaticClass()->GetDefaultObject()); }
UFUNCTION(BlueprintCallable, Category = "Physics")
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/PhysLevel.cpp:75
Scope (from outer to inner):
file
class class FEngineChaosSettingsProvider : public IChaosSettingsProvider
function const FChaosPhysicsSettings& GetChaosSettings
Source code excerpt:
const FChaosPhysicsSettings& GetChaosSettings() const
{
return GetSettings()->ChaosSettings;
}
const mutable UPhysicsSettings* Settings;
};
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/PhysicsSettings.cpp:68
Scope (from outer to inner):
file
function void UPhysicsSettings::PostInitProperties
Source code excerpt:
// Temporarily override dedicated thread to taskgraph. The enum selection for dedicated
// thread is hidden until that threading mode is made to work with the world physics system overall
if(ChaosSettings.DefaultThreadingModel == EChaosThreadingMode::DedicatedThread)
{
ChaosSettings.DefaultThreadingModel = EChaosThreadingMode::TaskGraph;
}
// Override the core Chaos default settings with this one if its the CDO (the one edited in Project Settings)
if (UPhysicsSettings::Get() == this)
{
UPhysicsSettingsCore::SetDefaultSettings(this);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/PhysicsSettings.cpp:111
Scope (from outer to inner):
file
function void UPhysicsSettings::PostEditChangeProperty
Source code excerpt:
const FName MemberName = PropertyChangedEvent.MemberProperty ? PropertyChangedEvent.MemberProperty->GetFName() : NAME_None;
if(MemberName == GET_MEMBER_NAME_CHECKED(UPhysicsSettings, ChaosSettings))
{
ChaosSettings.OnSettingsUpdated();
}
if(PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(UPhysicsSettingsCore, DefaultShapeComplexity))
{
for(TObjectIterator<UBodySetup> It; It; ++It)
{