ai.crowd.DrawDebugVelocityObstacles

ai.crowd.DrawDebugVelocityObstacles

#Overview

name: ai.crowd.DrawDebugVelocityObstacles

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ai.crowd.DrawDebugVelocityObstacles is to enable or disable the drawing of velocity obstacle sampling for crowd agents in Unreal Engine’s AI system. This setting is primarily used for debugging and visualization purposes in the crowd simulation module.

This setting variable is primarily used by the AI Module, specifically within the crowd management system. It’s part of the navigation and crowd simulation functionality in Unreal Engine.

The value of this variable is set through an FAutoConsoleVariableRef, which means it can be adjusted at runtime through the console. By default, it is set to 1 (enabled).

The associated variable DrawDebugVelocityObstacles interacts directly with ai.crowd.DrawDebugVelocityObstacles. They share the same value and purpose.

Developers should be aware of the following when using this variable:

  1. It requires ai.crowd.DebugSelectedActors to be set for the debug drawing to take effect.
  2. This is a debug feature and should be used primarily during development and testing, not in production builds.
  3. Enabling this feature may have a performance impact, especially in scenes with many crowd agents.

Best practices when using this variable include:

  1. Use it in conjunction with other debug drawing options for a comprehensive view of crowd agent behavior.
  2. Disable it in production builds to avoid unnecessary performance overhead.
  3. Combine it with ai.crowd.DebugSelectedActors to focus on specific agents when debugging.

Regarding the associated variable DrawDebugVelocityObstacles:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:66

Scope (from outer to inner):

file
namespace    FCrowdDebug

Source code excerpt:

	
	int32 DrawDebugVelocityObstacles = 1;
	FAutoConsoleVariableRef CVarDrawDebugVelocityObstacles(TEXT("ai.crowd.DrawDebugVelocityObstacles"), DrawDebugVelocityObstacles,
		TEXT("Draw velocity obstacle sampling, requires ai.crowd.DebugSelectedActors.\n0: Disable, 1: Enable"), ECVF_Default);
	
	int32 DrawDebugPathOptimization = 1;
	FAutoConsoleVariableRef CVarDrawDebugPathOptimization(TEXT("ai.crowd.DrawDebugPathOptimization"), DrawDebugPathOptimization,
		TEXT("Draw path optimization data, requires ai.crowd.DebugSelectedActors.\n0: Disable, 1: Enable"), ECVF_Default);
	

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Classes/Navigation/CrowdManager.h:385

Scope (from outer to inner):

file
class        class UCrowdManager : public UCrowdManagerBase

Source code excerpt:

	AIMODULE_API void DrawDebugCollisionSegments(const dtCrowdAgent* CrowdAgent) const;
	AIMODULE_API void DrawDebugPath(const dtCrowdAgent* CrowdAgent) const;
	AIMODULE_API void DrawDebugVelocityObstacles(const dtCrowdAgent* CrowdAgent) const;
	AIMODULE_API void DrawDebugPathOptimization(const dtCrowdAgent* CrowdAgent) const;
	AIMODULE_API void DrawDebugNeighbors(const dtCrowdAgent* CrowdAgent) const;
	AIMODULE_API void DrawDebugSharedBoundary() const;
#endif // ENABLE_DRAW_DEBUG

#endif

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:65

Scope (from outer to inner):

file
namespace    FCrowdDebug

Source code excerpt:

		TEXT("Draw active paths, requires ai.crowd.DebugSelectedActors.\n0: Disable, 1: Enable"), ECVF_Default);
	
	int32 DrawDebugVelocityObstacles = 1;
	FAutoConsoleVariableRef CVarDrawDebugVelocityObstacles(TEXT("ai.crowd.DrawDebugVelocityObstacles"), DrawDebugVelocityObstacles,
		TEXT("Draw velocity obstacle sampling, requires ai.crowd.DebugSelectedActors.\n0: Disable, 1: Enable"), ECVF_Default);
	
	int32 DrawDebugPathOptimization = 1;
	FAutoConsoleVariableRef CVarDrawDebugPathOptimization(TEXT("ai.crowd.DrawDebugPathOptimization"), DrawDebugPathOptimization,
		TEXT("Draw path optimization data, requires ai.crowd.DebugSelectedActors.\n0: Disable, 1: Enable"), ECVF_Default);
	

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:1058

Scope (from outer to inner):

file
function     void UCrowdManager::DrawDebugVelocityObstacles

Source code excerpt:

}

void UCrowdManager::DrawDebugVelocityObstacles(const dtCrowdAgent* CrowdAgent) const
{
	UWorld* DebugDrawingWorld = GetDebugDrawingWorld();

	FVector Center = Recast2UnrealPoint(CrowdAgent->npos) + FCrowdDebug::Offset;
	DrawDebugCylinder(DebugDrawingWorld, Center - FCrowdDebug::Offset, Center, UE_REAL_TO_FLOAT_CLAMPED_MAX(CrowdAgent->params.maxSpeed), 32, FCrowdDebug::AvoidanceRange);

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:1190

Scope (from outer to inner):

file
function     void UCrowdManager::DebugTick

Source code excerpt:

		}

		if (FCrowdDebug::DrawDebugVelocityObstacles)
		{
			DrawDebugVelocityObstacles(SelectedAgent);
		}

		if (FCrowdDebug::DrawDebugPathOptimization)
		{
			DrawDebugPathOptimization(SelectedAgent);
		}