p.Chaos.PBDCollisionSolver.MaxManifoldPoints
p.Chaos.PBDCollisionSolver.MaxManifoldPoints
#Overview
name: p.Chaos.PBDCollisionSolver.MaxManifoldPoints
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.MaxManifoldPoints is to control the maximum number of constraints that the Chaos physics engine will attempt to solve in collision detection and resolution. This setting is part of the Chaos physics system, which is an experimental physics engine in Unreal Engine 5.
This setting variable is primarily used by the Chaos physics subsystem, specifically within the collision solver module. It’s part of the experimental Chaos namespace, indicating it’s still in development and may be subject to changes.
The value of this variable is set through the Unreal Engine console variable system. It’s defined using FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.
The associated variable Chaos_Collision_MaxSolverManifoldPoints directly interacts with p.Chaos.PBDCollisionSolver.MaxManifoldPoints. They share the same value, with Chaos_Collision_MaxSolverManifoldPoints being the actual int32 variable used in the code, while p.Chaos.PBDCollisionSolver.MaxManifoldPoints is the console variable name.
Developers should be aware that:
- The default value is -1, which means unlimited constraints.
- Setting a positive value will limit the number of collision constraints solved, which can impact physics accuracy but may improve performance.
- This variable is part of the experimental Chaos physics system and may change in future engine versions.
Best practices when using this variable include:
- Only modify it if you’re experiencing performance issues related to complex collisions.
- Test thoroughly after changing the value, as it can significantly impact physics behavior.
- Consider the trade-off between performance and physics accuracy when setting a limit.
Regarding the associated variable Chaos_Collision_MaxSolverManifoldPoints:
- Its purpose is to store the actual integer value used in the collision solver logic.
- It’s used directly in the FPBDCollisionContainerSolver::PrepareSolverBuffer() function to limit the number of manifold points processed.
- The value is checked in a loop that processes collision constraints, potentially dropping some constraints if the limit is exceeded.
- Developers should be aware that this variable directly affects the physics simulation’s accuracy and performance.
- Best practice is to leave it at -1 (unlimited) unless specific performance optimizations are required, and to thoroughly test any changes to ensure desired physics behavior is maintained.
#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:56
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// 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
bool bChaos_Collision_EnableSoftCollisions = true;
FAutoConsoleVariableRef CVarChaosCollisionEnableSoftCollisions(TEXT("p.Chaos.PBDCollisionSolver.EnableSoftCollisions"), bChaos_Collision_EnableSoftCollisions, TEXT(""));
}
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_MaxSolverManifoldPoints
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionContainerSolver.cpp:55
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// 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
bool bChaos_Collision_EnableSoftCollisions = true;
FAutoConsoleVariableRef CVarChaosCollisionEnableSoftCollisions(TEXT("p.Chaos.PBDCollisionSolver.EnableSoftCollisions"), bChaos_Collision_EnableSoftCollisions, TEXT(""));
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionContainerSolver.cpp:457
Scope (from outer to inner):
file
namespace Chaos
function void FPBDCollisionContainerSolver::PrepareSolverBuffer
Source code excerpt:
// Count the manifold points
// @todo(chaos): can we avoid this?
const int32 ManifoldPointLimit = CVars::Chaos_Collision_MaxSolverManifoldPoints;
for (int32 ConstraintIndex = 0; ConstraintIndex < CollisionConstraints.Num(); ++ConstraintIndex)
{
const int32 MaxManifoldPoints = CalculateConstraintMaxManifoldPoints(GetConstraint(ConstraintIndex));
// Drop some of the constraints if we exceed some tunable maximum. This is purely to prevent massive
// slowdowns or excessive scratch allocations when too many collisions are generated.