p.chaos.AllowCreatePhysxBodies
p.chaos.AllowCreatePhysxBodies
#Overview
name: p.chaos.AllowCreatePhysxBodies
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0 is off, 1 is on (default)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.chaos.AllowCreatePhysxBodies is to control the creation of PhysX bodies in the Chaos physics system within Unreal Engine 5. This setting variable is part of the physics engine subsystem, specifically related to the Chaos physics implementation.
This setting variable is primarily used by the physics engine subsystem, particularly in the body initialization process. It’s referenced in the Engine module, specifically in the PhysicsEngine component.
The value of this variable is set as a console variable (CVar) with a default value of 1 (on). It can be changed at runtime through console commands or configuration files.
The associated variable CVarAllowCreatePhysxBodies directly interacts with p.chaos.AllowCreatePhysxBodies. They share the same value and purpose.
Developers must be aware that this variable acts as a global switch for PhysX body creation in the Chaos physics system. When set to 0, it prevents the creation of PhysX bodies, which could significantly impact physics simulations in the game.
Best practices when using this variable include:
- Keeping it enabled (set to 1) for normal physics operations.
- Only disabling it (setting to 0) when specifically testing or debugging physics-related issues.
- Being cautious about changing its value at runtime, as it could lead to unexpected behavior in ongoing physics simulations.
- Documenting any changes to this variable in project settings or configuration files to ensure consistency across the development team.
Regarding the associated variable CVarAllowCreatePhysxBodies:
The purpose of CVarAllowCreatePhysxBodies is identical to p.chaos.AllowCreatePhysxBodies. It’s the actual console variable implementation that controls the creation of PhysX bodies in the Chaos physics system.
This variable is used in the Engine module, specifically in the BodyInstance initialization process within the PhysicsEngine component.
The value of CVarAllowCreatePhysxBodies is set when the console variable is created, with a default value of 1. It can be accessed and potentially modified at runtime using console commands.
CVarAllowCreatePhysxBodies directly interacts with the p.chaos.AllowCreatePhysxBodies setting. They are essentially the same variable, with CVarAllowCreatePhysxBodies being the actual implementation.
Developers should be aware that this variable is marked as ECVF_ReadOnly, meaning it’s intended to be read-only after initial setup. Changing it at runtime might not be supported or could lead to unexpected behavior.
Best practices for CVarAllowCreatePhysxBodies are the same as for p.chaos.AllowCreatePhysxBodies, with the additional note to respect its read-only nature in production code.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/ConsoleVariables.ini:100, section: [Startup]
- INI Section:
Startup
- Raw value:
1
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodyInstance.cpp:1585
Scope: file
Source code excerpt:
// Chaos addition
static TAutoConsoleVariable<int32> CVarAllowCreatePhysxBodies(
TEXT("p.chaos.AllowCreatePhysxBodies"),
1,
TEXT("")
TEXT(" 0 is off, 1 is on (default)"),
ECVF_ReadOnly);
#Associated Variable and Callsites
This variable is associated with another variable named CVarAllowCreatePhysxBodies
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodyInstance.cpp:1584
Scope: file
Source code excerpt:
// Chaos addition
static TAutoConsoleVariable<int32> CVarAllowCreatePhysxBodies(
TEXT("p.chaos.AllowCreatePhysxBodies"),
1,
TEXT("")
TEXT(" 0 is off, 1 is on (default)"),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodyInstance.cpp:1594
Scope (from outer to inner):
file
function void FBodyInstance::InitBody
Source code excerpt:
void FBodyInstance::InitBody(class UBodySetup* Setup, const FTransform& Transform, UPrimitiveComponent* PrimComp, FPhysScene* InRBScene, const FInitBodySpawnParams& SpawnParams)
{
if (CVarAllowCreatePhysxBodies.GetValueOnGameThread() == 0)
{
return;
}
SCOPE_CYCLE_COUNTER(STAT_InitBody);
check(Setup);