r.Water.BuoyancyDebugPoints
r.Water.BuoyancyDebugPoints
#Overview
name: r.Water.BuoyancyDebugPoints
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of points in one dimension for buoyancy debug.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Water.BuoyancyDebugPoints is to control the number of points in one dimension for buoyancy debugging in Unreal Engine’s water system. This setting variable is primarily used for debugging and visualization purposes in the water simulation, specifically for the buoyancy component.
-
The Unreal Engine subsystem that relies on this setting variable is the Experimental Water plugin, particularly the buoyancy component within this plugin.
-
The value of this variable is set as a console variable with a default value of 10. It can be modified at runtime through console commands or programmatically.
-
This variable interacts with other debug-related variables, such as CVarWaterDebugBuoyancy and CVarWaterBuoyancyDebugSize. Together, these variables control the visualization of buoyancy effects in the water simulation.
-
Developers should be aware that this variable is primarily for debugging purposes and should not be relied upon for gameplay or production-ready features. It’s meant to help visualize and understand the buoyancy simulation.
-
Best practices when using this variable include:
- Use it in conjunction with other debug variables for a comprehensive view of the buoyancy system.
- Adjust the value to balance between detail and performance when debugging.
- Remember to disable or reduce debug visualization in production builds to optimize performance.
Regarding the associated variable CVarWaterBuoyancyDebugPoints:
The purpose of CVarWaterBuoyancyDebugPoints is the same as r.Water.BuoyancyDebugPoints. It’s an internal representation of the console variable within the C++ code.
-
This variable is used directly in the Water plugin’s buoyancy component implementation.
-
Its value is set when the console variable r.Water.BuoyancyDebugPoints is initialized or changed.
-
It interacts with other debug variables in the same way as r.Water.BuoyancyDebugPoints.
-
Developers should be aware that this is the actual variable used in the C++ code to access the debug points value.
-
Best practices for using this variable include:
- Access it using the GetValueOnAnyThread() method when needed in the code.
- Use it consistently with other debug variables for comprehensive debugging.
- Consider performance implications when frequently accessing this variable in performance-critical code paths.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/BuoyancyComponent.cpp:21
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarWaterBuoyancyDebugPoints(
TEXT("r.Water.BuoyancyDebugPoints"),
10,
TEXT("Number of points in one dimension for buoyancy debug."),
ECVF_Default);
TAutoConsoleVariable<int32> CVarWaterBuoyancyDebugSize(
TEXT("r.Water.BuoyancyDebugSize"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarWaterBuoyancyDebugPoints
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/BuoyancyComponent.cpp:20
Scope: file
Source code excerpt:
ECVF_Default);
TAutoConsoleVariable<int32> CVarWaterBuoyancyDebugPoints(
TEXT("r.Water.BuoyancyDebugPoints"),
10,
TEXT("Number of points in one dimension for buoyancy debug."),
ECVF_Default);
TAutoConsoleVariable<int32> CVarWaterBuoyancyDebugSize(
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/BuoyancyComponent.cpp:501
Scope (from outer to inner):
file
function int32 UBuoyancyComponent::UpdatePontoons
Source code excerpt:
if (CVarWaterDebugBuoyancy.GetValueOnAnyThread())
{
const float NumPoints = CVarWaterBuoyancyDebugPoints.GetValueOnAnyThread();
const float Size = CVarWaterBuoyancyDebugSize.GetValueOnAnyThread();
const float StartOffset = NumPoints * 0.5f;
const float Scale = Size / NumPoints;
TMap<const UWaterBodyComponent*, float> DebugSplineKeyMap;
TMap<const UWaterBodyComponent*, float> DebugSplineSegmentsMap;
for (int i = 0; i < NumPoints; ++i)
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Public/BuoyancyComponentSimulation.h:434
Scope (from outer to inner):
file
class class FBuoyancyComponentSim
function static void UpdateBuoyancy
Source code excerpt:
if (CVarWaterDebugBuoyancy.GetValueOnAnyThread())
{
const float NumPoints = CVarWaterBuoyancyDebugPoints.GetValueOnAnyThread();
const float Size = CVarWaterBuoyancyDebugSize.GetValueOnAnyThread();
const float StartOffset = NumPoints * 0.5f;
const float Scale = Size / NumPoints;
TMap<const FSolverSafeWaterBodyData*, float> DebugSplineKeyMap;
Chaos::FDebugDrawQueue::GetInstance().SetEnabled(true);
for (int i = 0; i < NumPoints; ++i)
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Public/BuoyancyTypes.h:10
Scope: file
Source code excerpt:
extern WATER_API TAutoConsoleVariable<int32> CVarWaterDebugBuoyancy;
extern WATER_API TAutoConsoleVariable<int32> CVarWaterBuoyancyDebugPoints;
extern WATER_API TAutoConsoleVariable<int32> CVarWaterBuoyancyDebugSize;
USTRUCT(Blueprintable)
struct FSphericalPontoon
{
GENERATED_BODY()