p.CVarGeometryCollectionImpulseWorkAround
p.CVarGeometryCollectionImpulseWorkAround
#Overview
name: p.CVarGeometryCollectionImpulseWorkAround
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
This enabled a workaround to allow impulses to be applied to geometry collection.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.CVarGeometryCollectionImpulseWorkAround is to enable a workaround that allows impulses to be applied to geometry collections in the character movement system.
This setting variable is primarily used in the character movement system, which is part of the Unreal Engine’s gameplay framework. Specifically, it is utilized in the CharacterMovementComponent, which handles character movement and physics interactions.
The value of this variable is set in the CharacterMovementCVars namespace within the CharacterMovementComponent.cpp file. It is initialized as a static boolean variable with a default value of true.
The associated variable bGeometryCollectionImpulseWorkAround interacts directly with this console variable. They share the same value, with bGeometryCollectionImpulseWorkAround being the actual boolean used in the code logic.
Developers must be aware that this variable is a workaround for a specific issue related to applying impulses to geometry collections. It’s important to understand that this is not a standard feature but a temporary solution to address a particular problem.
Best practices when using this variable include:
- Monitoring its impact on performance and physics behavior.
- Considering it as a temporary solution and looking for more permanent fixes in future engine updates.
- Testing thoroughly with and without the workaround enabled to ensure it doesn’t introduce unintended side effects.
Regarding the associated variable bGeometryCollectionImpulseWorkAround:
- Its purpose is to act as the actual boolean flag used in the code logic to enable or disable the geometry collection impulse workaround.
- It is used within the UCharacterMovementComponent::ApplyImpactPhysicsForces function to determine whether to apply a special handling for geometry collection components.
- The value is set through the console variable p.CVarGeometryCollectionImpulseWorkAround.
- Developers should be aware that this variable directly affects the behavior of impulse application to geometry collections in character movement scenarios.
- Best practices include carefully considering the implications of enabling or disabling this workaround, especially in projects heavily relying on geometry collections and character physics interactions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:299
Scope (from outer to inner):
file
namespace CharacterMovementCVars
Source code excerpt:
static bool bGeometryCollectionImpulseWorkAround = true;
FAutoConsoleVariableRef CVarGeometryCollectionImpulseWorkAround(
TEXT("p.CVarGeometryCollectionImpulseWorkAround"),
bGeometryCollectionImpulseWorkAround,
TEXT("This enabled a workaround to allow impulses to be applied to geometry collection.\n"),
ECVF_Default);
static int32 bUseLastGoodRotationDuringCorrection = 1;
FAutoConsoleVariableRef CVarUseLastGoodRotationDuringCorrection(
#Associated Variable and Callsites
This variable is associated with another variable named bGeometryCollectionImpulseWorkAround
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:297
Scope (from outer to inner):
file
namespace CharacterMovementCVars
Source code excerpt:
ECVF_Default);
static bool bGeometryCollectionImpulseWorkAround = true;
FAutoConsoleVariableRef CVarGeometryCollectionImpulseWorkAround(
TEXT("p.CVarGeometryCollectionImpulseWorkAround"),
bGeometryCollectionImpulseWorkAround,
TEXT("This enabled a workaround to allow impulses to be applied to geometry collection.\n"),
ECVF_Default);
static int32 bUseLastGoodRotationDuringCorrection = 1;
FAutoConsoleVariableRef CVarUseLastGoodRotationDuringCorrection(
TEXT("p.UseLastGoodRotationDuringCorrection"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:7473
Scope (from outer to inner):
file
function void UCharacterMovementComponent::ApplyImpactPhysicsForces
Source code excerpt:
bCanBePushed = true;
}
else if (CharacterMovementCVars::bGeometryCollectionImpulseWorkAround)
{
const FName ClassName = ImpactComponent->GetClass()->GetFName();
const FName GeometryCollectionClassName("GeometryCollectionComponent");
if (ClassName == GeometryCollectionClassName && ImpactComponent->BodyInstance.bSimulatePhysics)
{
// in some case GetBodyInstance can return null while the BodyInstance still exists ( geometry collection component for example )