p.Chaos.GC.EmitRootBreakingEvent
p.Chaos.GC.EmitRootBreakingEvent
#Overview
name: p.Chaos.GC.EmitRootBreakingEvent
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When true send a breaking event when root is breaking
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.GC.EmitRootBreakingEvent is to control whether a breaking event is sent when the root of a Geometry Collection is breaking. This setting variable is part of the Chaos physics system in Unreal Engine 5, specifically for Geometry Collections.
This setting variable is primarily used in the Geometry Collection Engine module, which is part of the experimental Chaos physics system in Unreal Engine 5. It affects the behavior of the UGeometryCollectionComponent class.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console. By default, it is set to false.
The associated variable GeometryCollectionEmitRootBreakingEvent directly interacts with p.Chaos.GC.EmitRootBreakingEvent. They share the same value and are used interchangeably in the code.
Developers must be aware that this is a temporary variable, as indicated by the comment in the code. It’s meant to be removed when the root event is no longer necessary. This suggests that the feature might be in transition or could be deprecated in future versions of the engine.
Best practices when using this variable include:
- Consider it as a temporary solution and plan for its potential removal in future engine versions.
- Use it cautiously in production code, as it may not be supported long-term.
- When enabled, ensure that the OnRootBreakEvent is properly handled in your code if you’re relying on root breaking events.
Regarding the associated variable GeometryCollectionEmitRootBreakingEvent:
The purpose of GeometryCollectionEmitRootBreakingEvent is the same as p.Chaos.GC.EmitRootBreakingEvent. It’s a boolean flag that determines whether to send a breaking event when the root of a Geometry Collection is breaking.
This variable is used in the UGeometryCollectionComponent::OnPostPhysicsSync function. When true, and if the root is broken (BrokenAndDecayedStates.GetIsRootBroken() returns true), it triggers the OnRootBreakEvent if it’s bound.
The value of this variable is set through the console variable p.Chaos.GC.EmitRootBreakingEvent.
Developers should be aware that this variable directly controls the emission of root breaking events. If your game logic depends on these events, you’ll need to ensure this variable is set to true.
Best practices include:
- Only enable this feature if you actually need to handle root breaking events in your game logic.
- Be prepared for this feature to potentially change or be removed in future engine versions, as it’s marked as temporary.
- If you’re using this feature, ensure you have proper error handling in place for cases where the event might not be emitted.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:126
Scope: file
Source code excerpt:
// temporary cvar , should be removed when the root event is no longer no necessary
bool GeometryCollectionEmitRootBreakingEvent = false;
FAutoConsoleVariableRef CVarGeometryCollectionEmitRootBreakingEvent(TEXT("p.Chaos.GC.EmitRootBreakingEvent"), GeometryCollectionEmitRootBreakingEvent, TEXT("When true send a breaking event when root is breaking"));
bool GeometryCollectionCreatePhysicsStateInEditor = false;
FAutoConsoleVariableRef CVarGeometryCollectionCreatePhysicsStateInEditor(TEXT("p.Chaos.GC.CreatePhysicsStateInEditor"), GeometryCollectionCreatePhysicsStateInEditor, TEXT("when on , physics state for a GC will be create in editor ( non PIE )"));
bool GeometryCollectionEnableRootProxyComponents = true;
FAutoConsoleVariableRef CVarGeometryCollectionRootProxyComponents(TEXT("p.Chaos.GC.EnableRootProxyComponents"), GeometryCollectionEnableRootProxyComponents, TEXT("when on ( by default ) , create root proxy components"));
#Associated Variable and Callsites
This variable is associated with another variable named GeometryCollectionEmitRootBreakingEvent
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:125
Scope: file
Source code excerpt:
// temporary cvar , should be removed when the root event is no longer no necessary
bool GeometryCollectionEmitRootBreakingEvent = false;
FAutoConsoleVariableRef CVarGeometryCollectionEmitRootBreakingEvent(TEXT("p.Chaos.GC.EmitRootBreakingEvent"), GeometryCollectionEmitRootBreakingEvent, TEXT("When true send a breaking event when root is breaking"));
bool GeometryCollectionCreatePhysicsStateInEditor = false;
FAutoConsoleVariableRef CVarGeometryCollectionCreatePhysicsStateInEditor(TEXT("p.Chaos.GC.CreatePhysicsStateInEditor"), GeometryCollectionCreatePhysicsStateInEditor, TEXT("when on , physics state for a GC will be create in editor ( non PIE )"));
bool GeometryCollectionEnableRootProxyComponents = true;
FAutoConsoleVariableRef CVarGeometryCollectionRootProxyComponents(TEXT("p.Chaos.GC.EnableRootProxyComponents"), GeometryCollectionEnableRootProxyComponents, TEXT("when on ( by default ) , create root proxy components"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:4336
Scope (from outer to inner):
file
function void UGeometryCollectionComponent::OnPostPhysicsSync
Source code excerpt:
if (BrokenAndDecayedStates.GetIsRootBroken())
{
if (GeometryCollectionEmitRootBreakingEvent)
{
if (OnRootBreakEvent.IsBound())
{
FChaosBreakEvent Event;
Event.Index = GetRootIndex();
Event.Component = this;