p.CVarGeometryCollectionImpulseWorkAround

p.CVarGeometryCollectionImpulseWorkAround

#Overview

name: p.CVarGeometryCollectionImpulseWorkAround

This variable is created as a Console Variable (cvar).

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:

  1. Monitoring its impact on performance and physics behavior.
  2. Considering it as a temporary solution and looking for more permanent fixes in future engine updates.
  3. Testing thoroughly with and without the workaround enabled to ensure it doesn’t introduce unintended side effects.

Regarding the associated variable bGeometryCollectionImpulseWorkAround:

#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 )