p.Chaos.Collision.Manifold.FrictionNearPositionTolerance
p.Chaos.Collision.Manifold.FrictionNearPositionTolerance
#Overview
name: p.Chaos.Collision.Manifold.FrictionNearPositionTolerance
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.Collision.Manifold.FrictionNearPositionTolerance is to define a distance threshold for determining whether a shape-relative contact point can still be considered the same point during collision detection in the Chaos physics system. This setting is primarily used in the collision handling and manifold generation process.
This setting variable is part of the Chaos physics system, which is an experimental physics engine within Unreal Engine 5. It is specifically used in the collision subsystem, particularly in the manifold generation and friction handling components.
The value of this variable is set through the Unreal Engine console variable system. It is initialized with a default value of 1.0f and can be modified at runtime using the console command system.
This variable interacts closely with another variable called Chaos_Manifold_FrictionExactPositionTolerance. While FrictionExactPositionTolerance defines a stricter threshold for point matching, FrictionNearPositionTolerance allows for a more lenient matching when no better options are available.
Developers must be aware that this variable affects the precision of friction calculations in collision detection. A larger value will allow for more leniency in considering contact points as the same, which can improve performance but may reduce accuracy in some scenarios.
Best practices when using this variable include:
- Carefully adjusting its value based on the scale and requirements of your game world.
- Testing thoroughly to ensure that changes to this value do not negatively impact the physical behavior of objects in your game.
- Considering the trade-off between performance and accuracy when modifying this value.
Regarding the associated variable Chaos_Manifold_FrictionNearPositionTolerance:
The purpose of Chaos_Manifold_FrictionNearPositionTolerance is identical to p.Chaos.Collision.Manifold.FrictionNearPositionTolerance. It’s the internal representation of the console variable within the Chaos physics system.
This variable is used directly in the collision handling code, specifically in the FindSavedManifoldPoint function of the FPBDCollisionConstraint class. It’s used to create a squared distance threshold for determining if a contact point should be considered the same as a previously saved point.
The value of this variable is set by the console variable system, mirroring the value of p.Chaos.Collision.Manifold.FrictionNearPositionTolerance.
It interacts closely with Chaos_Manifold_FrictionExactPositionTolerance, forming a two-tiered system for point matching in collision detection.
Developers should be aware that this variable directly affects the internal workings of the Chaos physics system and should be modified with caution.
Best practices include:
- Modifying this variable through the console variable system rather than changing it directly in the code.
- Monitoring its impact on both performance and physical accuracy when adjusting its value.
- Considering it in tandem with Chaos_Manifold_FrictionExactPositionTolerance for a comprehensive approach to contact point matching in collision detection.
#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/PBDCollisionConstraint.cpp:35
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FRealSingle Chaos_Manifold_FrictionNearPositionTolerance = 1.0f; // Distance a shape-relative contact point can move and still be considered the same point, if no better option exists
FAutoConsoleVariableRef CVarChaos_Manifold_FrictionExactPositionTolerance(TEXT("p.Chaos.Collision.Manifold.FrictionExactPositionTolerance"), Chaos_Manifold_FrictionExactPositionTolerance, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Manifold_FrictionNearPositionTolerance(TEXT("p.Chaos.Collision.Manifold.FrictionNearPositionTolerance"), Chaos_Manifold_FrictionNearPositionTolerance, TEXT(""));
FRealSingle Chaos_GBFCharacteristicTimeRatio = 1.0f;
FAutoConsoleVariableRef CVarChaos_GBFCharacteristicTimeRatio(TEXT("p.Chaos.Collision.GBFCharacteristicTimeRatio"), Chaos_GBFCharacteristicTimeRatio, TEXT("The ratio between characteristic time and Dt"));
bool bChaos_Manifold_EnableFrictionRestore = true;
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Manifold_FrictionNearPositionTolerance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionConstraint.cpp:33
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FRealSingle Chaos_Manifold_FrictionExactPositionTolerance = 0.2f; // Distance a shape-relative contact point can move and we can still be sure it's the same point (don't look for better options)
FRealSingle Chaos_Manifold_FrictionNearPositionTolerance = 1.0f; // Distance a shape-relative contact point can move and still be considered the same point, if no better option exists
FAutoConsoleVariableRef CVarChaos_Manifold_FrictionExactPositionTolerance(TEXT("p.Chaos.Collision.Manifold.FrictionExactPositionTolerance"), Chaos_Manifold_FrictionExactPositionTolerance, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Manifold_FrictionNearPositionTolerance(TEXT("p.Chaos.Collision.Manifold.FrictionNearPositionTolerance"), Chaos_Manifold_FrictionNearPositionTolerance, TEXT(""));
FRealSingle Chaos_GBFCharacteristicTimeRatio = 1.0f;
FAutoConsoleVariableRef CVarChaos_GBFCharacteristicTimeRatio(TEXT("p.Chaos.Collision.GBFCharacteristicTimeRatio"), Chaos_GBFCharacteristicTimeRatio, TEXT("The ratio between characteristic time and Dt"));
bool bChaos_Manifold_EnableFrictionRestore = true;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionConstraint.cpp:1138
Scope (from outer to inner):
file
namespace Chaos
function int32 FPBDCollisionConstraint::FindSavedManifoldPoint
Source code excerpt:
{
const FRealSingle ExactDistanceToleranceSq = FMath::Square(Chaos_Manifold_FrictionExactPositionTolerance);
const FRealSingle NearDistanceToleranceSq = FMath::Square(Chaos_Manifold_FrictionNearPositionTolerance);
// Ignore popints farther than NearDistanceTolerance
FRealSingle BestDistanceSq = NearDistanceToleranceSq;
int32 MatchAllowedPointIndex = INDEX_NONE;
for (int32 AllowedPointIndex = 0; AllowedPointIndex < InOutNumAllowedSavedPoints; ++AllowedPointIndex)