wp.Runtime.PlayerController.ForceUsingCameraAsStreamingSource

wp.Runtime.PlayerController.ForceUsingCameraAsStreamingSource

#Overview

name: wp.Runtime.PlayerController.ForceUsingCameraAsStreamingSource

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 wp.Runtime.PlayerController.ForceUsingCameraAsStreamingSource is to control the streaming source for World Partition in Unreal Engine 5. It determines whether to use the player’s camera or the player’s pawn as the streaming source.

This setting variable is primarily used in the Engine module, specifically within the PlayerController subsystem. It affects how the engine manages streaming of world content in World Partition-enabled projects.

The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 by default, meaning it uses the player pawn as the streaming source. Developers can change this value at runtime or through configuration files.

The associated variable ForceUsingCameraAsStreamingSource directly interacts with the console variable. They share the same value and purpose.

Developers must be aware that:

  1. This variable affects performance and streaming behavior in World Partition-enabled projects.
  2. Changing this value can impact how content is loaded and unloaded in the game world.
  3. It’s a boolean-like integer where 0 means use pawn, and 1 means use camera as the streaming source.

Best practices when using this variable include:

  1. Test both settings (0 and 1) to determine which works best for your specific project.
  2. Consider the implications on performance and gameplay when choosing between pawn and camera as the streaming source.
  3. Document any custom setting of this variable in your project to ensure consistency across the development team.

Regarding the associated variable ForceUsingCameraAsStreamingSource:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:101

Scope (from outer to inner):

file
namespace    PlayerControllerCVars

Source code excerpt:

	static int32 ForceUsingCameraAsStreamingSource = 0;
	FAutoConsoleVariableRef CVarForceUsingCameraAsStreamingSource(
		TEXT("wp.Runtime.PlayerController.ForceUsingCameraAsStreamingSource"),
		ForceUsingCameraAsStreamingSource,
		TEXT("Whether to force the use of the camera as the streaming source for World Partition. By default the player pawn is used.\n")
		TEXT("0: Use pawn as streaming source, 1: Use camera as streaming source"));
}

namespace NetworkPhysicsCvars

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:99

Scope (from outer to inner):

file
namespace    PlayerControllerCVars

Source code excerpt:

		ECVF_Default);

	static int32 ForceUsingCameraAsStreamingSource = 0;
	FAutoConsoleVariableRef CVarForceUsingCameraAsStreamingSource(
		TEXT("wp.Runtime.PlayerController.ForceUsingCameraAsStreamingSource"),
		ForceUsingCameraAsStreamingSource,
		TEXT("Whether to force the use of the camera as the streaming source for World Partition. By default the player pawn is used.\n")
		TEXT("0: Use pawn as streaming source, 1: Use camera as streaming source"));
}

namespace NetworkPhysicsCvars
{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:3671

Scope (from outer to inner):

file
function     void APlayerController::GetStreamingSourceLocationAndRotation

Source code excerpt:

void APlayerController::GetStreamingSourceLocationAndRotation(FVector& OutLocation, FRotator& OutRotation) const
{
	if (!PlayerControllerCVars::ForceUsingCameraAsStreamingSource)
	{
		if (const AActor* ViewTarget = GetViewTarget())
		{
			ViewTarget->GetActorEyesViewPoint(OutLocation, OutRotation);
			return;
		}