p.Chaos.Convex.KinematicMode
p.Chaos.Convex.KinematicMode
#Overview
name: p.Chaos.Convex.KinematicMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Simplification mode for the kinematic shapes (0: Single Convex, 1: One convex per children, 2: Merge connected children using the splitting threshold
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Convex.KinematicMode is to control the simplification mode for kinematic shapes in the Chaos physics system of Unreal Engine 5. This setting variable is part of the Chaos physics subsystem, which is an experimental physics engine in Unreal Engine 5.
The Chaos physics module relies on this setting variable to determine how to simplify kinematic shapes during convex hull generation. It is used in the ConvexOptimizer component of the Chaos system.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files. The default value is 2.
This variable interacts closely with another variable called ChaosConvexDynamicMode, which serves a similar purpose but for dynamic shapes instead of kinematic ones.
Developers must be aware that this variable has three possible values, each resulting in a different simplification strategy: 0: Single Convex 1: One convex per children 2: Merge connected children using the splitting threshold
The best practice when using this variable is to choose the appropriate mode based on the complexity of your kinematic objects and the performance requirements of your game. Mode 2 (the default) offers a balance between accuracy and performance, while mode 0 might be used for simpler objects or when prioritizing performance over accuracy.
Regarding the associated variable ChaosConvexKinematicMode:
The purpose of ChaosConvexKinematicMode is to store the actual value of the p.Chaos.Convex.KinematicMode setting. It is an integer variable that directly corresponds to the console variable.
This variable is used within the Chaos physics system, specifically in the ConvexOptimizer component, to determine the simplification mode for kinematic shapes during runtime.
The value of ChaosConvexKinematicMode is set by the FAutoConsoleVariableRef mechanism, which links it to the p.Chaos.Convex.KinematicMode console variable.
It interacts directly with the p.Chaos.Convex.KinematicMode console variable and is used in conjunction with ChaosConvexDynamicMode to determine the overall simplification strategy for both kinematic and dynamic shapes.
Developers should be aware that modifying p.Chaos.Convex.KinematicMode will directly affect the value of ChaosConvexKinematicMode.
Best practices for using this variable include accessing it through the CVars namespace (CVars::ChaosConvexKinematicMode) and treating it as a read-only variable in most cases, allowing the console variable system to manage its value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ConvexOptimizer.cpp:17
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// Max number of convex LODs used during simplification for dynamic particles
int32 ChaosConvexKinematicMode = 2;
FAutoConsoleVariableRef CVarChaosConvexKinematicMode(TEXT("p.Chaos.Convex.KinematicMode"), ChaosConvexKinematicMode, TEXT("Simplification mode for the kinematic shapes (0: Single Convex, 1: One convex per children, 2: Merge connected children using the splitting threshold"));
// Max number of convex LODs used during simplification for kinematic particles
int32 ChaosConvexDynamicMode = 2;
FAutoConsoleVariableRef CVarChaosConvexDynamicMode(TEXT("p.Chaos.Convex.DynamicMode"), ChaosConvexDynamicMode, TEXT("Simplification mode for the dynamic shapes (0: Single Convex, 1: One convex per children, 2: Merge connected children using the splitting threshold)"));
// Tribox volume / convex hull threshold to trigger a volume splitting during tree construction
#Associated Variable and Callsites
This variable is associated with another variable named ChaosConvexKinematicMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ConvexOptimizer.cpp:16
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// Max number of convex LODs used during simplification for dynamic particles
int32 ChaosConvexKinematicMode = 2;
FAutoConsoleVariableRef CVarChaosConvexKinematicMode(TEXT("p.Chaos.Convex.KinematicMode"), ChaosConvexKinematicMode, TEXT("Simplification mode for the kinematic shapes (0: Single Convex, 1: One convex per children, 2: Merge connected children using the splitting threshold"));
// Max number of convex LODs used during simplification for kinematic particles
int32 ChaosConvexDynamicMode = 2;
FAutoConsoleVariableRef CVarChaosConvexDynamicMode(TEXT("p.Chaos.Convex.DynamicMode"), ChaosConvexDynamicMode, TEXT("Simplification mode for the dynamic shapes (0: Single Convex, 1: One convex per children, 2: Merge connected children using the splitting threshold)"));
// Tribox volume / convex hull threshold to trigger a volume splitting during tree construction
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ConvexOptimizer.cpp:129
Scope (from outer to inner):
file
namespace Chaos
namespace Private
function void FConvexOptimizer::SimplifyRootConvexes
Source code excerpt:
if((UnionShapes.Num() == 1) || ((ObjectState == EObjectStateType::Dynamic) && (CVars::ChaosConvexDynamicMode == 0))
|| ((ObjectState != EObjectStateType::Dynamic) && (CVars::ChaosConvexKinematicMode == 0)))
{
BuildSingleConvex(UnionGeometry, UnionShapes, bOptimizeConvexes);
}
else
{
const bool bEnableMerging = ((ObjectState == EObjectStateType::Dynamic) && (CVars::ChaosConvexDynamicMode == 2))
|| ((ObjectState != EObjectStateType::Dynamic) && (CVars::ChaosConvexKinematicMode == 2));
BuildMultipleConvex(UnionGeometry, UnionShapes, bEnableMerging, bOptimizeConvexes);
}
}
if(CVars::bChaosUnionBVHEnabled)
{