p.Chaos.Solver.DebugDrawSpatialAccelerationStructure
p.Chaos.Solver.DebugDrawSpatialAccelerationStructure
#Overview
name: p.Chaos.Solver.DebugDrawSpatialAccelerationStructure
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Draw spatial acceleration structure
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.DebugDrawSpatialAccelerationStructure is to enable debug drawing of the spatial acceleration structure in Unreal Engine’s Chaos physics system. This setting is part of the debugging and visualization tools for the Chaos solver, which is a component of the physics simulation subsystem.
This setting variable is primarily used by the Chaos physics module within Unreal Engine. Specifically, it’s utilized in the PBDRigidsSolver (Position Based Dynamics Rigids Solver) component of the Chaos system.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files.
There are two other closely related variables that interact with this setting:
- ChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves
- ChaosSolverDebugDrawSpatialAccelerationStructureShowNodes
These variables control additional details of the spatial acceleration structure visualization, specifically whether to show leaves and nodes.
Developers should be aware that this is a debugging tool and should be used primarily during development and testing phases. Enabling this visualization may have performance implications, especially in complex scenes with many physics objects.
Best practices for using this variable include:
- Use it in conjunction with other Chaos solver debug draw options for a comprehensive view of the physics system.
- Be mindful of performance impact when enabling in large or complex scenes.
- Use it in combination with the related “ShowLeaves” and “ShowNodes” options for more detailed visualization.
Regarding the associated variable ChaosSolverDebugDrawSpatialAccelerationStructure:
This is the actual integer variable that stores the state of the debug draw setting. It’s initialized to 0 (disabled) by default. The console variable p.Chaos.Solver.DebugDrawSpatialAccelerationStructure is linked to this variable, allowing it to be changed via console commands.
The ChaosSolverDebugDrawSpatialAccelerationStructure variable is used in the FPBDRigidsSolver::PostTickDebugDraw function to determine whether to perform the debug drawing of the spatial acceleration structure. When enabled (non-zero), it triggers the DebugDraw::DrawSpatialAccelerationStructure function to visualize the structure.
Developers should note that this variable directly controls the debug visualization, so changing its value will immediately affect whether the spatial acceleration structure is drawn in the debug view.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:161
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverDrawJoints(TEXT("p.Chaos.Solver.DebugDrawJoints"), ChaosSolverDrawJoints, TEXT("Draw joints"));
FAutoConsoleVariableRef CVarChaosSolverDrawCharacterGroundConstraints(TEXT("p.Chaos.Solver.DebugDrawCharacterGroundConstraints"), ChaosSolverDrawCharacterGroundConstraints, TEXT("Draw character ground constraints"));
FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructure(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure"), ChaosSolverDebugDrawSpatialAccelerationStructure, TEXT("Draw spatial acceleration structure"));
FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure.ShowLeaves"), ChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves, TEXT("Show spatial acceleration structure leaves when its debug draw is enabled"));
FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructureShowNodes(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure.ShowNodes"), ChaosSolverDebugDrawSpatialAccelerationStructureShowNodes, TEXT("Show spatial acceleration structure nodes when its debug draw is enabled"));
FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesCoMConnector(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.CoMConnector"), ChaosSolverDrawJointFeatures.bCoMConnector, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesActorConnector(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.ActorConnector"), ChaosSolverDrawJointFeatures.bActorConnector, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesStretch(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.Stretch"), ChaosSolverDrawJointFeatures.bStretch, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesAxes(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.Axes"), ChaosSolverDrawJointFeatures.bAxes, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverDebugDrawSpatialAccelerationStructure
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:134
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 ChaosSolverDrawJoints = 0;
int32 ChaosSolverDrawCharacterGroundConstraints = 0;
int32 ChaosSolverDebugDrawSpatialAccelerationStructure = 0;
int32 ChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves = 0;
int32 ChaosSolverDebugDrawSpatialAccelerationStructureShowNodes = 0;
int32 ChaosSolverDebugDrawSuspensionConstraints = 0;
int32 ChaosSolverDrawClusterConstraints = 0;
int32 ChaosSolverDebugDrawMeshContacts = 0;
int32 ChaosSolverDebugDrawMeshBVHOverlaps = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:161
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverDrawJoints(TEXT("p.Chaos.Solver.DebugDrawJoints"), ChaosSolverDrawJoints, TEXT("Draw joints"));
FAutoConsoleVariableRef CVarChaosSolverDrawCharacterGroundConstraints(TEXT("p.Chaos.Solver.DebugDrawCharacterGroundConstraints"), ChaosSolverDrawCharacterGroundConstraints, TEXT("Draw character ground constraints"));
FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructure(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure"), ChaosSolverDebugDrawSpatialAccelerationStructure, TEXT("Draw spatial acceleration structure"));
FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure.ShowLeaves"), ChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves, TEXT("Show spatial acceleration structure leaves when its debug draw is enabled"));
FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructureShowNodes(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure.ShowNodes"), ChaosSolverDebugDrawSpatialAccelerationStructureShowNodes, TEXT("Show spatial acceleration structure nodes when its debug draw is enabled"));
FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesCoMConnector(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.CoMConnector"), ChaosSolverDrawJointFeatures.bCoMConnector, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesActorConnector(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.ActorConnector"), ChaosSolverDrawJointFeatures.bActorConnector, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesStretch(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.Stretch"), ChaosSolverDrawJointFeatures.bStretch, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesAxes(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.Axes"), ChaosSolverDrawJointFeatures.bAxes, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:2603
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PostTickDebugDraw
Source code excerpt:
DebugDraw::DrawCharacterGroundConstraints(FRigidTransform3(), MEvolution->GetCharacterGroundConstraints(), &ChaosSolverDebugDebugDrawSettings);
}
if (ChaosSolverDebugDrawSpatialAccelerationStructure)
{
if (const auto SpatialAccelerationStructure = GetEvolution()->GetSpatialAcceleration())
{
DebugDraw::DrawSpatialAccelerationStructure(*SpatialAccelerationStructure, &ChaosSolverDebugDebugDrawSettings);
}
}