p.Chaos.Collision.EnableCollisionManager
p.Chaos.Collision.EnableCollisionManager
#Overview
name: p.Chaos.Collision.EnableCollisionManager
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable Chaos\'s Collision Manager for ignoring collisions between rigid bodies. [def:1]
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.EnableCollisionManager is to control the activation of Chaos’s Collision Manager, which is responsible for managing collision ignoring between rigid bodies in the Unreal Engine’s physics system.
This setting variable is primarily used within the PhysicsCore module of Unreal Engine 5, specifically in the Chaos physics engine implementation. It directly affects the behavior of the collision system in Chaos.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through the console or configuration files. By default, it is set to true (1), enabling the Collision Manager.
The associated variable bEnableChaosCollisionManager interacts directly with p.Chaos.Collision.EnableCollisionManager. They share the same value, and bEnableChaosCollisionManager is used in the actual code logic to determine whether certain collision-related operations should be performed.
Developers must be aware that disabling this variable (setting it to false) will prevent the Collision Manager from functioning, which could lead to unexpected behavior in physics simulations where collision ignoring is required.
Best practices when using this variable include:
- Keeping it enabled (default state) unless there’s a specific reason to disable it.
- If disabling, ensure that alternative methods for managing collisions are implemented if necessary.
- Testing thoroughly when modifying this setting, as it can have wide-ranging effects on physics behavior in the game.
Regarding the associated variable bEnableChaosCollisionManager:
Its purpose is to provide a runtime-accessible boolean flag that reflects the state of the p.Chaos.Collision.EnableCollisionManager console variable.
This variable is used in the PhysicsCore module, specifically in the ChaosEngineInterface implementation.
Its value is set by the FAutoConsoleVariableRef, which links it to the p.Chaos.Collision.EnableCollisionManager console variable.
bEnableChaosCollisionManager is used in conditional statements to determine whether to execute certain collision management functions, such as AddDisabledCollisionsFor_AssumesLocked and RemoveDisabledCollisionsFor_AssumesLocked.
Developers should be aware that this variable directly controls the execution of collision management code, and disabling it will bypass these functions.
Best practices for using bEnableChaosCollisionManager include:
- Treating it as read-only in most cases, as its value is controlled by the console variable.
- Using it for conditional execution of collision management code rather than modifying it directly.
- Considering its state when debugging physics-related issues, as it can significantly affect collision behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosEngineInterface.cpp:42
Scope: file
Source code excerpt:
bool bEnableChaosCollisionManager = true;
FAutoConsoleVariableRef CVarEnableChaosCollisionManager(TEXT("p.Chaos.Collision.EnableCollisionManager"), bEnableChaosCollisionManager, TEXT("Enable Chaos's Collision Manager for ignoring collisions between rigid bodies. [def:1]"));
bool FPhysicsConstraintReference_Chaos::IsValid() const
{
return Constraint!=nullptr ? Constraint->IsValid() : false;
}
const Chaos::FImplicitObject& FPhysicsShapeReference_Chaos::GetGeometry() const
#Associated Variable and Callsites
This variable is associated with another variable named bEnableChaosCollisionManager
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosEngineInterface.cpp:41
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarEnableChaosJointConstraints(TEXT("p.ChaosSolverEnableJointConstraints"), bEnableChaosJointConstraints, TEXT("Enable Joint Constraints defined within the Physics Asset Editor"));
bool bEnableChaosCollisionManager = true;
FAutoConsoleVariableRef CVarEnableChaosCollisionManager(TEXT("p.Chaos.Collision.EnableCollisionManager"), bEnableChaosCollisionManager, TEXT("Enable Chaos's Collision Manager for ignoring collisions between rigid bodies. [def:1]"));
bool FPhysicsConstraintReference_Chaos::IsValid() const
{
return Constraint!=nullptr ? Constraint->IsValid() : false;
}
const Chaos::FImplicitObject& FPhysicsShapeReference_Chaos::GetGeometry() const
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosEngineInterface.cpp:326
Scope (from outer to inner):
file
function void FChaosEngineInterface::AddDisabledCollisionsFor_AssumesLocked
Source code excerpt:
void FChaosEngineInterface::AddDisabledCollisionsFor_AssumesLocked(const TMap<FPhysicsActorHandle, TArray< FPhysicsActorHandle > >& InMap)
{
if (bEnableChaosCollisionManager)
{
for (auto Elem : InMap)
{
FPhysicsActorHandle& ActorReference = Elem.Key;
Chaos::FUniqueIdx ActorIndex = ActorReference->GetGameThreadAPI().UniqueIdx();
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosEngineInterface.cpp:364
Scope (from outer to inner):
file
function void FChaosEngineInterface::RemoveDisabledCollisionsFor_AssumesLocked
Source code excerpt:
void FChaosEngineInterface::RemoveDisabledCollisionsFor_AssumesLocked(TArray< FPhysicsActorHandle >& InPhysicsActors)
{
if (bEnableChaosCollisionManager)
{
for (FPhysicsActorHandle& ActorReference : InPhysicsActors)
{
Chaos::FUniqueIdx ActorIndex = ActorReference->GetGameThreadAPI().UniqueIdx();
Chaos::FPhysicsSolver* Solver = ActorReference->GetSolver<Chaos::FPhysicsSolver>();