p.VisualizeMovement
p.VisualizeMovement
#Overview
name: p.VisualizeMovement
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to draw in-world debug information for character movement.\n0: Disable, 1: Enable
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.VisualizeMovement is to enable or disable the visualization of in-world debug information for character movement in Unreal Engine 5.
This setting variable is primarily used by the character movement system, specifically within the CharacterMovementComponent. It is part of the Engine module and is utilized for debugging and development purposes.
The value of this variable is set through a console command. It is defined as a static integer variable within the CharacterMovementCVars namespace and is associated with an FAutoConsoleVariableRef named CVarVisualizeMovement. The variable can be set to 0 (disabled) or 1 (enabled) through the console.
The associated variable VisualizeMovement interacts directly with p.VisualizeMovement. They share the same value and are used interchangeably within the code.
Developers should be aware that this variable is intended for debugging and development purposes only. It is marked with ECVF_Cheat, indicating that it should not be used in shipping builds. The visualization is only active in non-shipping and non-test builds, as evidenced by the conditional compilation directives.
Best practices when using this variable include:
- Only enable it during development and debugging sessions.
- Be aware that enabling this visualization may impact performance, so use it judiciously.
- Remember to disable it before creating shipping builds.
- Use it in conjunction with other debugging tools to get a comprehensive view of character movement behavior.
Regarding the associated variable VisualizeMovement:
The purpose of VisualizeMovement is to serve as an internal representation of the p.VisualizeMovement console variable within the CharacterMovementComponent.
It is used within the TickComponent function of the CharacterMovementComponent to determine whether to call the VisualizeMovement() function, which draws the debug information.
The value of this variable is set by the console command p.VisualizeMovement through the FAutoConsoleVariableRef mechanism.
Developers should treat VisualizeMovement as they would p.VisualizeMovement, remembering that changes to one will affect the other. It’s important to note that direct manipulation of VisualizeMovement should be avoided in favor of using the console command to ensure consistency.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:384
Scope (from outer to inner):
file
namespace CharacterMovementCVars
Source code excerpt:
static int32 VisualizeMovement = 0;
FAutoConsoleVariableRef CVarVisualizeMovement(
TEXT("p.VisualizeMovement"),
VisualizeMovement,
TEXT("Whether to draw in-world debug information for character movement.\n")
TEXT("0: Disable, 1: Enable"),
ECVF_Cheat);
static int32 NetVisualizeSimulatedCorrections = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/CharacterMovementComponent.h:1842
Scope: file
Source code excerpt:
/**
* Draw in-world debug information for character movement (called with p.VisualizeMovement > 0).
*/
ENGINE_API virtual float VisualizeMovement() const;
/** Check if swimming pawn just ran into edge of the pool and should jump out. */
ENGINE_API virtual bool CheckWaterJump(FVector CheckPoint, FVector& WallNormal);
/** Returns whether this pawn is currently allowed to walk off ledges */
ENGINE_API virtual bool CanWalkOffLedges() const;
#Associated Variable and Callsites
This variable is associated with another variable named VisualizeMovement
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/CharacterMovementComponent.h:1844
Scope: file
Source code excerpt:
* Draw in-world debug information for character movement (called with p.VisualizeMovement > 0).
*/
ENGINE_API virtual float VisualizeMovement() const;
/** Check if swimming pawn just ran into edge of the pool and should jump out. */
ENGINE_API virtual bool CheckWaterJump(FVector CheckPoint, FVector& WallNormal);
/** Returns whether this pawn is currently allowed to walk off ledges */
ENGINE_API virtual bool CanWalkOffLedges() const;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:382
Scope (from outer to inner):
file
namespace CharacterMovementCVars
Source code excerpt:
ECVF_Cheat);
static int32 VisualizeMovement = 0;
FAutoConsoleVariableRef CVarVisualizeMovement(
TEXT("p.VisualizeMovement"),
VisualizeMovement,
TEXT("Whether to draw in-world debug information for character movement.\n")
TEXT("0: Disable, 1: Enable"),
ECVF_Cheat);
static int32 NetVisualizeSimulatedCorrections = 0;
FAutoConsoleVariableRef CVarNetVisualizeSimulatedCorrections(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:1658
Scope (from outer to inner):
file
function void UCharacterMovementComponent::TickComponent
Source code excerpt:
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
const bool bVisualizeMovement = CharacterMovementCVars::VisualizeMovement > 0;
if (bVisualizeMovement)
{
VisualizeMovement();
}
#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
}
void UCharacterMovementComponent::PrePhysicsTickComponent(float DeltaTime, FCharacterMovementComponentPrePhysicsTickFunction& ThisTickFunction)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:7606
Scope (from outer to inner):
file
function float UCharacterMovementComponent::VisualizeMovement
Source code excerpt:
}
float UCharacterMovementComponent::VisualizeMovement() const
{
float HeightOffset = 0.f;
const float OffsetPerElement = 10.0f;
if (CharacterOwner == nullptr)
{
return HeightOffset;