p.Chaos.PBDCollisionSolver.EnableInitialDepenetration
p.Chaos.PBDCollisionSolver.EnableInitialDepenetration
#Overview
name: p.Chaos.PBDCollisionSolver.EnableInitialDepenetration
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.PBDCollisionSolver.EnableInitialDepenetration is to control the activation of the new initial overlap depenetration system within the Chaos physics engine of Unreal Engine 5. This setting is specifically related to the collision handling system in the physics simulation.
This setting variable is primarily used in the Chaos physics module, which is part of Unreal Engine’s experimental physics system. Based on the callsites, it’s clear that this variable is utilized in the PBDCollisionContainerSolver, which is responsible for solving collision constraints in the Position-Based Dynamics (PBD) system.
The value of this variable is set through an FAutoConsoleVariableRef, which allows it to be modified at runtime via console commands. It’s initialized to true by default.
The associated variable bChaos_Collision_EnableInitialDepenetration directly interacts with this setting. They share the same value, with the console variable acting as an interface to modify the associated boolean variable.
Developers must be aware that this variable controls a specific feature of the collision solver. When enabled, it allows the system to calculate and handle initial overlaps between colliding objects more accurately. This can be particularly important for improving the stability and realism of physics simulations, especially in scenarios where objects might start in an overlapping state.
Best practices when using this variable include:
- Testing physics simulations with both enabled and disabled states to ensure desired behavior in all scenarios.
- Considering performance implications, as enabling this feature might increase computational costs.
- Using it in conjunction with other collision-related settings for fine-tuning physics behavior.
Regarding the associated variable bChaos_Collision_EnableInitialDepenetration:
- Its purpose is to store the actual boolean state of whether the initial depenetration system is enabled.
- It’s used directly in the collision solving logic, specifically in the UpdateCollisionSolverContactPointFromConstraint function.
- The value is set by the console variable we discussed earlier.
- It interacts with other physics parameters like MaxDepenetrationVelocity.
- Developers should be aware that this variable directly affects the behavior of the collision solver at a low level.
- Best practices include ensuring consistency between this variable and the console variable, and considering its impact on physics behavior when debugging collision issues.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionContainerSolver.cpp:52
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// Whether to enable the new initial overlap depentration system
bool bChaos_Collision_EnableInitialDepenetration = true;
FAutoConsoleVariableRef CVarChaosCollisionEnableInitialDepentration(TEXT("p.Chaos.PBDCollisionSolver.EnableInitialDepenetration"), bChaos_Collision_EnableInitialDepenetration, TEXT(""));
// The maximum number of constraints we will attempt to solve (-1 for unlimited)
int32 Chaos_Collision_MaxSolverManifoldPoints = -1;
FAutoConsoleVariableRef CVarChaosCollisionMaxSolverManifoldPoints(TEXT("p.Chaos.PBDCollisionSolver.MaxManifoldPoints"), Chaos_Collision_MaxSolverManifoldPoints, TEXT(""));
// Whether to enable the experimental soft collisions
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_Collision_EnableInitialDepenetration
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionContainerSolver.cpp:51
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// Whether to enable the new initial overlap depentration system
bool bChaos_Collision_EnableInitialDepenetration = true;
FAutoConsoleVariableRef CVarChaosCollisionEnableInitialDepentration(TEXT("p.Chaos.PBDCollisionSolver.EnableInitialDepenetration"), bChaos_Collision_EnableInitialDepenetration, TEXT(""));
// The maximum number of constraints we will attempt to solve (-1 for unlimited)
int32 Chaos_Collision_MaxSolverManifoldPoints = -1;
FAutoConsoleVariableRef CVarChaosCollisionMaxSolverManifoldPoints(TEXT("p.Chaos.PBDCollisionSolver.MaxManifoldPoints"), Chaos_Collision_MaxSolverManifoldPoints, TEXT(""));
// Whether to enable the experimental soft collisions
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionContainerSolver.cpp:160
Scope (from outer to inner):
file
namespace Chaos
function void UpdateCollisionSolverContactPointFromConstraint
Source code excerpt:
// If we have an initial contact, calculate the initial overlap. This will get saved in SetSolverResults
FRealSingle WorldContactInitialPhi = 0;
if ((MaxDepenetrationVelocity >= 0) && CVars::bChaos_Collision_EnableInitialDepenetration)
{
if (ManifoldPoint.Flags.bInitialContact)
{
// This is a new manifold point, capture current Phi as the initial Phi
WorldContactInitialPhi = WorldContactResidualPhi;