p.Chaos.Collision.AABBBoundsCheck
p.Chaos.Collision.AABBBoundsCheck
#Overview
name: p.Chaos.Collision.AABBBoundsCheck
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.AABBBoundsCheck
is to control the Axis-Aligned Bounding Box (AABB) bounds check in the Chaos physics engine’s collision detection system. This setting variable is part of the collision resolution subsystem within Unreal Engine’s Chaos physics module.
The Chaos physics engine, which is an experimental module in Unreal Engine 5, relies on this setting variable for optimizing collision detection. Specifically, it’s used in the narrow phase of collision detection, where more precise checks are performed on potentially colliding objects.
The value of this variable is set through the Unreal Engine’s console variable system. It’s initialized as true by default, as seen in the code:
bool Chaos_Collision_NarrowPhase_AABBBoundsCheck = true;
FAutoConsoleVariableRef CVarChaosCollisionAABBBoundsCheck(TEXT("p.Chaos.Collision.AABBBoundsCheck"), Chaos_Collision_NarrowPhase_AABBBoundsCheck, TEXT(""));
This variable interacts closely with another variable Chaos_Collision_NarrowPhase_SphereBoundsCheck
, which is likely used for sphere-based collision checks. They are defined and initialized together, suggesting they work in tandem for different types of collision checks.
Developers must be aware that this variable affects the performance and accuracy of collision detection. Enabling it (set to true) will perform AABB bounds checks, which can improve collision detection accuracy but may impact performance. Disabling it might improve performance but could potentially miss some collisions.
Best practices when using this variable include:
- Keep it enabled (true) for most scenarios to ensure accurate collision detection.
- Consider disabling it in performance-critical situations where you can afford to trade some accuracy for speed.
- Always test thoroughly when changing this setting, as it can significantly affect game physics behavior.
Regarding the associated variable Chaos_Collision_NarrowPhase_AABBBoundsCheck
:
This is the actual boolean variable that stores the state of the AABB bounds check. It’s directly controlled by the console variable p.Chaos.Collision.AABBBoundsCheck
.
The purpose of Chaos_Collision_NarrowPhase_AABBBoundsCheck
is to provide a quick access point for the collision system to check whether AABB bounds checks should be performed. It’s used in the narrow phase of collision detection, as indicated by its name.
This variable is defined in the Chaos collision resolution system and is likely accessed in various parts of the collision detection code to determine whether to perform AABB bounds checks.
The value of this variable is set by the console variable system, allowing it to be changed at runtime through console commands.
Developers should be aware that changing this variable directly in code won’t have the desired effect, as it’s controlled by the console variable system. Always use the console variable p.Chaos.Collision.AABBBoundsCheck
to modify this setting.
Best practices include using this variable for conditional logic in collision detection algorithms, and ensuring that any performance-critical code paths consider its state for optimization purposes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:74
Scope: file
Source code excerpt:
bool Chaos_Collision_NarrowPhase_AABBBoundsCheck = true;
FAutoConsoleVariableRef CVarChaosCollisionSphereBoundsCheck(TEXT("p.Chaos.Collision.SphereBoundsCheck"), Chaos_Collision_NarrowPhase_SphereBoundsCheck, TEXT(""));
FAutoConsoleVariableRef CVarChaosCollisionAABBBoundsCheck(TEXT("p.Chaos.Collision.AABBBoundsCheck"), Chaos_Collision_NarrowPhase_AABBBoundsCheck, TEXT(""));
bool bChaos_Collision_ShapesArrayMode = true;
FAutoConsoleVariableRef CVarChaos_Collision_ShapesArrayMode(TEXT("p.Chaos.Collision.ShapesArrayMode"), bChaos_Collision_ShapesArrayMode, TEXT(""));
namespace Chaos
{
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_NarrowPhase_AABBBoundsCheck
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ParticlePairMidPhase.cpp:25
Scope: file
Source code excerpt:
TRACE_DECLARE_INT_COUNTER_EXTERN(ChaosTraceCounter_MidPhase_NumGeneric);
extern bool Chaos_Collision_NarrowPhase_AABBBoundsCheck;
// Enable for extended stats. Slow but useful for determining counts and relative costs of midphases
#if 0
#define CHAOS_MIDPHASE_SCOPE_CYCLE_TIMER(X) QUICK_SCOPE_CYCLE_COUNTER(X)
#else
#define CHAOS_MIDPHASE_SCOPE_CYCLE_TIMER(X)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:72
Scope: file
Source code excerpt:
bool Chaos_Collision_NarrowPhase_SphereBoundsCheck = true;
bool Chaos_Collision_NarrowPhase_AABBBoundsCheck = true;
FAutoConsoleVariableRef CVarChaosCollisionSphereBoundsCheck(TEXT("p.Chaos.Collision.SphereBoundsCheck"), Chaos_Collision_NarrowPhase_SphereBoundsCheck, TEXT(""));
FAutoConsoleVariableRef CVarChaosCollisionAABBBoundsCheck(TEXT("p.Chaos.Collision.AABBBoundsCheck"), Chaos_Collision_NarrowPhase_AABBBoundsCheck, TEXT(""));
bool bChaos_Collision_ShapesArrayMode = true;
FAutoConsoleVariableRef CVarChaos_Collision_ShapesArrayMode(TEXT("p.Chaos.Collision.ShapesArrayMode"), bChaos_Collision_ShapesArrayMode, TEXT(""));
namespace Chaos
{