p.Chaos.Collision.OneWayStiffness
p.Chaos.Collision.OneWayStiffness
#Overview
name: p.Chaos.Collision.OneWayStiffness
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Collision solver stiffnes for one-way interactions
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.OneWayStiffness is to control the collision solver stiffness for one-way interactions in the Chaos physics system of Unreal Engine 5. This setting variable is part of the collision handling mechanism within the Chaos physics simulation.
The Chaos physics subsystem, which is part of Unreal Engine’s experimental features, relies on this setting variable. Specifically, it is used in the collision constraint system of Chaos.
The value of this variable is set initially to 0.5f in the C++ code. It is then exposed as a console variable using FAutoConsoleVariableRef, allowing it to be adjusted at runtime or through configuration files.
The associated variable Chaos_Collision_OneWayStiffness directly interacts with p.Chaos.Collision.OneWayStiffness. They share the same value, with Chaos_Collision_OneWayStiffness being the actual variable used in the code, while p.Chaos.Collision.OneWayStiffness is the console variable name.
Developers must be aware that this variable affects how “hard” collisions with static objects are treated compared to dynamic objects. It’s particularly important for preventing one-way objects from being squeezed out of the world when a dynamic object lands on top of them.
Best practices when using this variable include:
- Carefully tuning its value to achieve the desired balance between static and dynamic object interactions.
- Testing thoroughly with various scenarios involving one-way objects and dynamic objects to ensure proper behavior.
- Being mindful of its impact on overall physics simulation stability and performance.
Regarding the associated variable Chaos_Collision_OneWayStiffness:
The purpose of Chaos_Collision_OneWayStiffness is to store the actual value used in the collision solver calculations for one-way interactions.
It is used directly in the Chaos physics subsystem, specifically in the FPBDCollisionConstraint::UpdateMassScales function.
The value of this variable is set initially in the code and can be modified through the console variable p.Chaos.Collision.OneWayStiffness.
This variable directly interacts with the Stiffness property of collision materials in the UpdateMassScales function.
Developers should be aware that changes to this variable will directly affect the behavior of one-way collisions in the physics simulation.
Best practices include monitoring this variable’s value during runtime debugging and adjusting it as needed to achieve the desired collision behavior for one-way interactions.
#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:62
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
// lands on top of them. Instead, they will stay on top of the terrain and sink into the dynamic.
FRealSingle Chaos_Collision_OneWayStiffness = 0.5f;
FAutoConsoleVariableRef CVarChaos_Collision_OneWayStiffness(TEXT("p.Chaos.Collision.OneWayStiffness"), Chaos_Collision_OneWayStiffness, TEXT("Collision solver stiffnes for one-way interactions"));
bool bChaos_Collision_EnableBoundsChecks = true;
FAutoConsoleVariableRef CVarChaos_Collision_EnableBoundsChecks(TEXT("p.Chaos.Collision.EnableBoundsChecks"), bChaos_Collision_EnableBoundsChecks, TEXT(""));
// Maximum number of manifold points per contact (-1 for unlimited)
int32 Chaos_Collision_MaxManifoldPoints = -1;
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_OneWayStiffness
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionConstraint.cpp:61
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
// will treat collisions with the static scene as "harder" than collisions with dynamics which will prevent one-way objects from getting squeezed out of the world when a dynamic
// lands on top of them. Instead, they will stay on top of the terrain and sink into the dynamic.
FRealSingle Chaos_Collision_OneWayStiffness = 0.5f;
FAutoConsoleVariableRef CVarChaos_Collision_OneWayStiffness(TEXT("p.Chaos.Collision.OneWayStiffness"), Chaos_Collision_OneWayStiffness, TEXT("Collision solver stiffnes for one-way interactions"));
bool bChaos_Collision_EnableBoundsChecks = true;
FAutoConsoleVariableRef CVarChaos_Collision_EnableBoundsChecks(TEXT("p.Chaos.Collision.EnableBoundsChecks"), bChaos_Collision_EnableBoundsChecks, TEXT(""));
// Maximum number of manifold points per contact (-1 for unlimited)
int32 Chaos_Collision_MaxManifoldPoints = -1;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionConstraint.cpp:495
Scope (from outer to inner):
file
namespace Chaos
function void FPBDCollisionConstraint::UpdateMassScales
Source code excerpt:
Material.InvInertiaScale0 = 0;
}
Stiffness = Chaos_Collision_OneWayStiffness;
}
else
{
Material.InvMassScale0 = 1;
Material.InvInertiaScale0 = 1;
Material.InvMassScale1 = 1;