p.GeometryCollectionEnableForcedConvexGenerationInSerialize
p.GeometryCollectionEnableForcedConvexGenerationInSerialize
#Overview
name: p.GeometryCollectionEnableForcedConvexGenerationInSerialize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable generation of convex geometry on older destruction files.[def:true]
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.GeometryCollectionEnableForcedConvexGenerationInSerialize is to enable the generation of convex geometry on older destruction files during serialization of Geometry Collections in Unreal Engine 5.
This setting variable is primarily used in the Geometry Collection Engine module, which is part of the Chaos physics system in Unreal Engine 5. It specifically affects the serialization process of Geometry Collections, which are used for destructible objects in the engine.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands. By default, it is set to true.
The associated variable bGeometryCollectionEnableForcedConvexGenerationInSerialize directly interacts with this console variable. They share the same value and purpose.
Developers must be aware that this variable affects the behavior of older destruction files. When enabled, it forces the generation of convex geometry during serialization, which can impact performance and memory usage.
Best practices when using this variable include:
- Keep it enabled (default) unless there’s a specific reason to disable it.
- Be mindful of the performance impact when working with large numbers of older destruction files.
- Consider disabling it temporarily if you’re experiencing performance issues during serialization of Geometry Collections.
Regarding the associated variable bGeometryCollectionEnableForcedConvexGenerationInSerialize:
The purpose of this variable is identical to p.GeometryCollectionEnableForcedConvexGenerationInSerialize, as they share the same value.
It is used within the UGeometryCollection::Serialize function to determine whether to generate convex hull data for Geometry Collections that lack it, but use the Chaos_Implicit_Convex collision type.
This variable is set by the console variable p.GeometryCollectionEnableForcedConvexGenerationInSerialize.
When this variable is true and a Geometry Collection lacks convex hull data but uses the Convex implicit type, the code will change the implicit type to Box and set a flag to recreate simulation data.
Developers should be aware that this variable can affect the collision behavior of Geometry Collections, potentially changing them from Convex to Box collision if convex hull data is missing.
Best practices include ensuring that all Geometry Collections have proper convex hull data to avoid unexpected changes in collision behavior during serialization.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionObject.cpp:58
Scope: file
Source code excerpt:
bool bGeometryCollectionEnableForcedConvexGenerationInSerialize = true;
FAutoConsoleVariableRef CVarGeometryCollectionEnableForcedConvexGenerationInSerialize(
TEXT("p.GeometryCollectionEnableForcedConvexGenerationInSerialize"),
bGeometryCollectionEnableForcedConvexGenerationInSerialize,
TEXT("Enable generation of convex geometry on older destruction files.[def:true]"));
bool bGeometryCollectionAlwaysRecreateSimulationData = false;
FAutoConsoleVariableRef CVarGeometryCollectionAlwaysRecreateSimulationData(
TEXT("p.GeometryCollectionAlwaysRecreateSimulationData"),
#Associated Variable and Callsites
This variable is associated with another variable named bGeometryCollectionEnableForcedConvexGenerationInSerialize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionObject.cpp:56
Scope: file
Source code excerpt:
TEXT("Bypass the construction of simulation properties when all bodies are simply cached for playback."));
bool bGeometryCollectionEnableForcedConvexGenerationInSerialize = true;
FAutoConsoleVariableRef CVarGeometryCollectionEnableForcedConvexGenerationInSerialize(
TEXT("p.GeometryCollectionEnableForcedConvexGenerationInSerialize"),
bGeometryCollectionEnableForcedConvexGenerationInSerialize,
TEXT("Enable generation of convex geometry on older destruction files.[def:true]"));
bool bGeometryCollectionAlwaysRecreateSimulationData = false;
FAutoConsoleVariableRef CVarGeometryCollectionAlwaysRecreateSimulationData(
TEXT("p.GeometryCollectionAlwaysRecreateSimulationData"),
bGeometryCollectionAlwaysRecreateSimulationData,
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionObject.cpp:1172
Scope (from outer to inner):
file
function void UGeometryCollection::Serialize
Source code excerpt:
{
#if WITH_EDITOR
if (bGeometryCollectionEnableForcedConvexGenerationInSerialize)
{
if (!FGeometryCollectionConvexUtility::HasConvexHullData(GeometryCollection.Get()) &&
GeometryCollection::SizeSpecific::UsesImplicitCollisionType(SizeSpecificData, EImplicitTypeEnum::Chaos_Implicit_Convex))
{
GeometryCollection::SizeSpecific::SetImplicitCollisionType(SizeSpecificData, EImplicitTypeEnum::Chaos_Implicit_Box, EImplicitTypeEnum::Chaos_Implicit_Convex);
bCreateSimulationData = true;