p.Chaos.DebugDraw.SingleActorTraceLength

p.Chaos.DebugDraw.SingleActorTraceLength

#Overview

name: p.Chaos.DebugDraw.SingleActorTraceLength

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.DebugDraw.SingleActorTraceLength is to set the trace length from the camera used to select a single actor for debug drawing in the Chaos physics system of Unreal Engine 5.

This setting variable is primarily used in the Chaos physics debug drawing subsystem, which is part of the experimental ChaosSolverEngine module. It’s specifically utilized in the ChaosDebugDrawComponent.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through the console or configuration files. Its default value is 2000.0f.

This variable interacts closely with other debug drawing settings, particularly:

  1. p.Chaos.DebugDraw.SingleActor: Determines if debug drawing should be performed for the actor the camera is looking at.
  2. p.Chaos.DebugDraw.SingleActorMaxRadius: Sets the maximum radius to draw around the single actor.

Developers should be aware that this variable directly affects the range at which the debug drawing system will attempt to select an actor for visualization. A larger value will allow selection of actors further from the camera, while a smaller value will limit the selection to nearby actors.

Best practices when using this variable include:

  1. Adjusting it based on the scale of your game world to ensure appropriate actor selection.
  2. Using it in conjunction with p.Chaos.DebugDraw.SingleActor for targeted debugging.
  3. Considering performance implications when setting very large values, as it may lead to unnecessary calculations.

Regarding the associated variable ChaosDebugDraw_SingleActorTraceLength:

This is the actual float variable that stores the trace length value. It’s initialized with the same default value (2000.0f) and is directly modified by the console variable p.Chaos.DebugDraw.SingleActorTraceLength.

It’s used in the UChaosDebugDrawComponent::TickComponent function to calculate the end point of a trace from the camera’s position. This trace is used to determine which actor should be selected for debug drawing.

Developers should note that modifying p.Chaos.DebugDraw.SingleActorTraceLength will directly affect this variable, and thus the behavior of the debug drawing system. It’s primarily used internally by the Chaos debug drawing system and doesn’t typically need direct manipulation by game code.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:40

Scope: file

Source code excerpt:


float ChaosDebugDraw_SingleActorTraceLength = 2000.0f;
FAutoConsoleVariableRef CVarChaosDebugDraw_SingleActorTraceLength(TEXT("p.Chaos.DebugDraw.SingleActorTraceLength"), ChaosDebugDraw_SingleActorTraceLength, TEXT("Set the trace length from the camera that is used to select the single actor."));

float ChaosDebugDraw_SingleActorMaxRadius = 1000.0f;
FAutoConsoleVariableRef CVarChaosDebugDraw_SingleActorMaxRadius(TEXT("p.Chaos.DebugDraw.SingleActorMaxRadius"), ChaosDebugDraw_SingleActorMaxRadius, TEXT("Set the max radius to draw around the single actor."));

float ChaosDebugDraw_ShowPIEServer = false;
FAutoConsoleVariableRef CVarChaos_DebugDraw_ShowPIEServer(TEXT("p.Chaos.DebugDraw.ShowPIEServer"), ChaosDebugDraw_ShowPIEServer, TEXT("When running in PIE mode, show the server debug draw"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:39

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarChaosDebugDraw_SingleActor(TEXT("p.Chaos.DebugDraw.SingleActor"), bChaosDebugDraw_SingleActor, TEXT("If true, then we draw for the actor the camera is looking at."));

float ChaosDebugDraw_SingleActorTraceLength = 2000.0f;
FAutoConsoleVariableRef CVarChaosDebugDraw_SingleActorTraceLength(TEXT("p.Chaos.DebugDraw.SingleActorTraceLength"), ChaosDebugDraw_SingleActorTraceLength, TEXT("Set the trace length from the camera that is used to select the single actor."));

float ChaosDebugDraw_SingleActorMaxRadius = 1000.0f;
FAutoConsoleVariableRef CVarChaosDebugDraw_SingleActorMaxRadius(TEXT("p.Chaos.DebugDraw.SingleActorMaxRadius"), ChaosDebugDraw_SingleActorMaxRadius, TEXT("Set the max radius to draw around the single actor."));

float ChaosDebugDraw_ShowPIEServer = false;
FAutoConsoleVariableRef CVarChaos_DebugDraw_ShowPIEServer(TEXT("p.Chaos.DebugDraw.ShowPIEServer"), ChaosDebugDraw_ShowPIEServer, TEXT("When running in PIE mode, show the server debug draw"));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:299

Scope (from outer to inner):

file
function     void UChaosDebugDrawComponent::TickComponent

Source code excerpt:

					Controller->GetPlayerViewPoint(CamLoc, CamRot);
					FVector CamForward = CamRot.Vector();
					CamForward *= ChaosDebugDraw_SingleActorTraceLength;

					FVector TraceStart = CamLoc;
					FVector TraceEnd = TraceStart + CamForward;

					FHitResult HitResult(ForceInit);
					FCollisionQueryParams TraceParams(SCENE_QUERY_STAT(ChaosDebugVisibilityTrace), true, Controller->GetPawn());