p.RigidBodyNode.DebugDraw
p.RigidBodyNode.DebugDraw
#Overview
name: p.RigidBodyNode.DebugDraw
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to debug draw the rigid body simulation state. Requires p.Chaos.DebugDraw.Enabled 1 to function as well.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.RigidBodyNode.DebugDraw is to enable debug drawing of the rigid body simulation state in the Unreal Engine animation system. This setting is specifically related to the animation system’s rigid body simulation functionality.
This setting variable is primarily used in the AnimGraphRuntime module, specifically within the AnimNode_RigidBody component. Based on the callsites, it’s clear that this variable is utilized in the animation graph runtime for debugging purposes.
The value of this variable is set through the Unreal Engine Console Variable system. It’s defined as a boolean FAutoConsoleVariableRef, which means it can be toggled on or off via console commands or configuration files.
The associated variable bRBAN_DebugDraw directly interacts with p.RigidBodyNode.DebugDraw. They share the same value, and bRBAN_DebugDraw is used in the actual code logic to determine whether to perform debug drawing.
Developers must be aware of the following when using this variable:
- It requires p.Chaos.DebugDraw.Enabled to be set to 1 to function properly.
- Enabling this debug draw may impact performance, so it should be used judiciously, primarily for debugging and development purposes.
- The debug drawing occurs even if the simulation is deferred, to show shapes relative to the current transform.
Best practices when using this variable include:
- Only enable it when necessary for debugging rigid body simulations in animations.
- Ensure p.Chaos.DebugDraw.Enabled is also set correctly when using this variable.
- Disable it in production builds to avoid any potential performance impact.
- Use it in conjunction with other debugging tools to get a comprehensive view of the animation system’s behavior.
Regarding the associated variable bRBAN_DebugDraw: The purpose of bRBAN_DebugDraw is to act as the internal boolean flag that controls the actual debug drawing functionality within the AnimNode_RigidBody component.
It’s used directly in the AnimGraphRuntime module, specifically in the FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread function.
The value of bRBAN_DebugDraw is set by the p.RigidBodyNode.DebugDraw console variable.
This variable directly interacts with the PhysicsSimulation object, calling its DebugDraw method when enabled.
Developers should be aware that this variable controls the actual drawing and is checked during the skeletal control evaluation, which is a performance-sensitive area.
Best practices for bRBAN_DebugDraw include using it only when necessary for debugging, and ensuring it’s disabled in production to avoid any performance overhead from unnecessary debug drawing calls.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:101
Scope: file
Source code excerpt:
bool bRBAN_DebugDraw = false;
FAutoConsoleVariableRef CVarRigidBodyNodeDebugDraw(TEXT("p.RigidBodyNode.DebugDraw"), bRBAN_DebugDraw, TEXT("Whether to debug draw the rigid body simulation state. Requires p.Chaos.DebugDraw.Enabled 1 to function as well."), ECVF_Default);
// Temporary to avoid out of bounds access issue
bool bRBAN_InitializeBoneReferencesRangeCheckEnabled = true;
FAutoConsoleVariableRef CVarRigidBodyNodeInitializeBoneReferencesRangeCheckEnabled(TEXT("p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled"), bRBAN_InitializeBoneReferencesRangeCheckEnabled, TEXT(""), ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named bRBAN_DebugDraw
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:100
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarRigidBodyNodeDeferredSimulationForceDefault(TEXT("p.RigidBodyNode.DeferredSimulationForceDefault"), bRBAN_DeferredSimulationForceDefault, TEXT("When true, rigid body simulation will always use the value of p.RigidBodyNode.DeferredSimulationDefault to determine whether to defer the simulation work, ignoring the setting in the individual node."), ECVF_Default);
bool bRBAN_DebugDraw = false;
FAutoConsoleVariableRef CVarRigidBodyNodeDebugDraw(TEXT("p.RigidBodyNode.DebugDraw"), bRBAN_DebugDraw, TEXT("Whether to debug draw the rigid body simulation state. Requires p.Chaos.DebugDraw.Enabled 1 to function as well."), ECVF_Default);
// Temporary to avoid out of bounds access issue
bool bRBAN_InitializeBoneReferencesRangeCheckEnabled = true;
FAutoConsoleVariableRef CVarRigidBodyNodeInitializeBoneReferencesRangeCheckEnabled(TEXT("p.RigidBodyNode.InitializeBoneReferencesRangeCheckEnabled"), bRBAN_InitializeBoneReferencesRangeCheckEnabled, TEXT(""), ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:853
Scope (from outer to inner):
file
function void FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread
Source code excerpt:
// Draw here even if the simulation is deferred since we want the shapes drawn relative to the current transform
if (bRBAN_DebugDraw)
{
PhysicsSimulation->DebugDraw();
}
}
//write back to animation system