p.GeometryCollection.ForceOverrideGCCollisionSetupForTraces
p.GeometryCollection.ForceOverrideGCCollisionSetupForTraces
#Overview
name: p.GeometryCollection.ForceOverrideGCCollisionSetupForTraces
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Force the usage of a specific type of collision for traces on the game thread when creating new GC physics representations (-1: use the value of the property | 0: force to use SM collision | 1: force to use GC collision) [def: -1]
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.GeometryCollection.ForceOverrideGCCollisionSetupForTraces is to control the type of collision used for traces on the game thread when creating new Geometry Collection physics representations. This setting variable is primarily used in the physics system, specifically for Geometry Collections in Unreal Engine’s Chaos physics engine.
This setting variable is relied upon by the Experimental Chaos module, which is part of Unreal Engine’s physics system. It’s specifically used in the GeometryCollectionPhysicsProxy component.
The value of this variable is set through a console variable (CVar) system. It’s defined using FAutoConsoleVariableRef, which allows it to be changed at runtime through console commands or configuration files.
The associated variable ForceOverrideGCCollisionSetupForTraces interacts directly with p.GeometryCollection.ForceOverrideGCCollisionSetupForTraces. They share the same value and purpose.
Developers must be aware that this variable has three possible values:
- -1: Use the value of the property (default)
- 0: Force the use of Static Mesh (SM) collision
- 1: Force the use of Geometry Collection (GC) collision
When using this variable, developers should consider the performance implications of their choice. Using Static Mesh collision might be faster in some cases, while Geometry Collection collision might provide more accurate results in others.
Best practices when using this variable include:
- Use the default value (-1) unless there’s a specific reason to override it.
- Test performance with different settings to determine the best option for your specific use case.
- Be cautious when forcing a specific collision type, as it might affect gameplay or physics behavior in unexpected ways.
Regarding the associated variable ForceOverrideGCCollisionSetupForTraces:
This variable is an internal representation of the console variable. It’s used directly in the code to determine which collision setup to use. The purpose and usage are the same as p.GeometryCollection.ForceOverrideGCCollisionSetupForTraces.
It’s important to note that this variable is only modifiable in non-shipping builds. In shipping builds, it’s set as a constexpr to GCCSFT_Property, which likely corresponds to the default behavior of using the property value.
When working with this variable, developers should be aware that it’s used in conditional statements to determine the collision setup. For example, in the SetUseStaticMeshCollisionForTraces_External function, it’s used to decide whether to use Static Mesh collision for traces.
Best practices for this associated variable are similar to those for the console variable. Developers should be cautious when modifying it directly in code, as it could lead to inconsistent behavior if not aligned with the console variable setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:167
Scope: file
Source code excerpt:
int32 ForceOverrideGCCollisionSetupForTraces = GCCSFT_Property;
FAutoConsoleVariableRef CVarForceOverrideGCCollisionSetupForTraces(
TEXT("p.GeometryCollection.ForceOverrideGCCollisionSetupForTraces"),
ForceOverrideGCCollisionSetupForTraces,
TEXT("Force the usage of a specific type of collision for traces on the game thread when creating new GC physics representations (-1: use the value of the property | 0: force to use SM collision | 1: force to use GC collision) [def: -1]"));
#else
constexpr int32 ForceOverrideGCCollisionSetupForTraces = GCCSFT_Property;
#Associated Variable and Callsites
This variable is associated with another variable named ForceOverrideGCCollisionSetupForTraces
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:165
Scope: file
Source code excerpt:
#if !UE_BUILD_SHIPPING
int32 ForceOverrideGCCollisionSetupForTraces = GCCSFT_Property;
FAutoConsoleVariableRef CVarForceOverrideGCCollisionSetupForTraces(
TEXT("p.GeometryCollection.ForceOverrideGCCollisionSetupForTraces"),
ForceOverrideGCCollisionSetupForTraces,
TEXT("Force the usage of a specific type of collision for traces on the game thread when creating new GC physics representations (-1: use the value of the property | 0: force to use SM collision | 1: force to use GC collision) [def: -1]"));
#else
constexpr int32 ForceOverrideGCCollisionSetupForTraces = GCCSFT_Property;
#endif // !UE_BUILD_SHIPPING
DEFINE_LOG_CATEGORY_STATIC(UGCC_LOG, Error, All);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:3363
Scope (from outer to inner):
file
function void FGeometryCollectionPhysicsProxy::SetUseStaticMeshCollisionForTraces_External
Source code excerpt:
// Expensive, so only do it when we need to
const bool bUseSMCollisionForTraces = ((bInUseStaticMeshCollisionForTraces && ForceOverrideGCCollisionSetupForTraces == GCCSFT_Property) || (ForceOverrideGCCollisionSetupForTraces == GCCSFT_ForceSM));
if (Parameters.bUseStaticMeshCollisionForTraces != bUseSMCollisionForTraces && CreateTraceCollisionGeometryCallback != nullptr)
{
const int32 TransformIndex = Parameters.InitialRootIndex;
const int32 ParticleIndex = FromTransformToParticleIndex[TransformIndex];
if (GTParticles.IsValidIndex(ParticleIndex))
{