p.Chaos.SQ.DrawDebugVisitorQueries

p.Chaos.SQ.DrawDebugVisitorQueries

#Overview

name: p.Chaos.SQ.DrawDebugVisitorQueries

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.SQ.DrawDebugVisitorQueries is to enable debug drawing of bounds for objects visited by visitors during scene queries in the Chaos physics system of Unreal Engine 5. This setting is primarily used for debugging and visualization purposes within the physics simulation.

This setting variable is used in the PhysicsCore module of Unreal Engine, specifically within the Chaos physics system. It is part of the scene query (SQ) functionality, which is responsible for performing spatial queries in the physics simulation.

The value of this variable is set through a console variable (CVar) system. It is initialized to 0 and can be changed at runtime using the console command “p.Chaos.SQ.DrawDebugVisitorQueries”.

The associated variable ChaosSQDrawDebugVisitorQueries directly interacts with p.Chaos.SQ.DrawDebugVisitorQueries. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable is only active when CHAOS_DEBUG_DRAW is defined. It’s primarily intended for debugging purposes and should not be relied upon for gameplay or production builds.

Best practices when using this variable include:

  1. Only enable it when debugging physics-related issues, particularly those involving scene queries.
  2. Be mindful of potential performance impact when enabled, as it adds additional drawing calls.
  3. Use in conjunction with other Chaos physics debug tools for comprehensive analysis.
  4. Remember to disable it in production builds to avoid unnecessary overhead.

Regarding the associated variable ChaosSQDrawDebugVisitorQueries:

The purpose of ChaosSQDrawDebugVisitorQueries is identical to p.Chaos.SQ.DrawDebugVisitorQueries. It’s an internal representation of the console variable used within the C++ code.

This variable is used directly in the PhysicsCore module, specifically in the scene query visitor implementation.

Its value is set through the console variable system and is shared with p.Chaos.SQ.DrawDebugVisitorQueries.

The variable interacts directly with the debug drawing system when CHAOS_DEBUG_DRAW is defined.

Developers should be aware that this variable is conditionally compiled and only available in debug builds or when CHAOS_DEBUG_DRAW is explicitly defined.

Best practices for using ChaosSQDrawDebugVisitorQueries include:

  1. Use it for internal logic in the physics system rather than directly in game code.
  2. Ensure CHAOS_DEBUG_DRAW is defined when you need to use this variable.
  3. Be cautious about performance implications when enabling this debug feature in development builds.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/SQVisitor.cpp:4

Scope: file

Source code excerpt:

#if CHAOS_DEBUG_DRAW
int32 ChaosSQDrawDebugVisitorQueries = 0;
FAutoConsoleVariableRef CVarChaosSQDrawDebugQueries(TEXT("p.Chaos.SQ.DrawDebugVisitorQueries"), ChaosSQDrawDebugVisitorQueries, TEXT("Draw bounds of objects visited by visitors in scene queries."));
#endif

#Associated Variable and Callsites

This variable is associated with another variable named ChaosSQDrawDebugVisitorQueries. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/SQVisitor.cpp:3

Scope: file

Source code excerpt:


#if CHAOS_DEBUG_DRAW
int32 ChaosSQDrawDebugVisitorQueries = 0;
FAutoConsoleVariableRef CVarChaosSQDrawDebugQueries(TEXT("p.Chaos.SQ.DrawDebugVisitorQueries"), ChaosSQDrawDebugVisitorQueries, TEXT("Draw bounds of objects visited by visitors in scene queries."));
#endif

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Public/SQVisitor.h:21

Scope: file

Source code excerpt:


#if CHAOS_DEBUG_DRAW
extern PHYSICSCORE_API int32 ChaosSQDrawDebugVisitorQueries;
extern PHYSICSCORE_API FAutoConsoleVariableRef CVarChaosSQDrawDebugQueries;
#endif

template <typename TLocationHit>
void FillHitHelper(TLocationHit& Hit, const Chaos::FReal Distance, const FVector& WorldPosition, const FVector& WorldNormal, int32 FaceIdx, bool bComputeMTD)
{

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Public/SQVisitor.h:398

Scope (from outer to inner):

file
function     bool Visit

Source code excerpt:


#if CHAOS_DEBUG_DRAW
		if (DebugParams.IsDebugQuery() && ChaosSQDrawDebugVisitorQueries)
		{
			DebugDraw<SQ>(Instance, CurData, bAllShapesIgnoredInPrefilter, bHitBufferIncreased);
		}
#endif

		return bContinue;