r.Water.WaterZoneActor.OverrideNewWaterZoneMinimumMargin

r.Water.WaterZoneActor.OverrideNewWaterZoneMinimumMargin

#Overview

name: r.Water.WaterZoneActor.OverrideNewWaterZoneMinimumMargin

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 r.Water.WaterZoneActor.OverrideNewWaterZoneMinimumMargin is to enforce a minimum distance between the landscape and the WaterZone actor extent in the Unreal Engine 5 water system. This setting variable is specifically used in the Water plugin’s editor module.

This setting variable is primarily used by the Experimental Water plugin, specifically within the Water Editor module. It’s part of the water zone actor creation and manipulation system.

The value of this variable is set as a console variable (CVar) in the WaterEditorModule namespace. It’s initialized with a default value of 0, which means no override is applied by default.

This variable interacts closely with another variable named CVarOverrideNewWaterZoneScale. Both are used together to control the sizing and positioning of WaterZone actors relative to the landscape.

Developers must be aware that this variable only takes effect when creating or adjusting WaterZone actors. A value of 0 means no minimum margin is enforced, while any positive value will ensure a minimum distance between the landscape and the water zone extent.

Best practices when using this variable include:

  1. Use it in conjunction with CVarOverrideNewWaterZoneScale for fine-tuned control over water zone placement.
  2. Adjust the value based on the scale of your landscape and desired water effects.
  3. Remember that setting it to 0 disables the minimum margin enforcement.

Regarding the associated variable CVarOverrideNewWaterZoneScale:

The purpose of CVarOverrideNewWaterZoneScale is to multiply the WaterZone actor extent beyond the landscape by a specified amount.

This variable is also part of the Experimental Water plugin’s editor module and is used in conjunction with CVarOverrideNewWaterZoneMinimumMargin to control WaterZone actor sizing.

The value is set as a console variable in the same location as CVarOverrideNewWaterZoneMinimumMargin, with a default value of 0 (meaning no override).

When using this variable, developers should:

  1. Understand that a value of 0 means no scaling override will be applied.
  2. Use it to quickly adjust the size of water zones relative to the landscape without manually resizing each actor.
  3. Consider the performance implications of very large water zones when setting high scale values.

Both variables work together to provide flexible control over water zone placement and sizing in the Unreal Engine 5 water system.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Editor/Private/WaterEditorModule.cpp:38

Scope (from outer to inner):

file
namespace    WaterEditorModule

Source code excerpt:

{
	static TAutoConsoleVariable<float> CVarOverrideNewWaterZoneScale(TEXT("r.Water.WaterZoneActor.OverrideNewWaterZoneScale"), 0, TEXT("Multiply WaterZone actor extent beyond landscape by this amount. 0 means no override."));
	static TAutoConsoleVariable<float> CVarOverrideNewWaterZoneMinimumMargin(TEXT("r.Water.WaterZoneActor.OverrideNewWaterZoneMinimumMargin"), 0, TEXT("Enforce a minimum distance between landscape and the WaterZone actor extent. 0 means no override."));
}

void FWaterEditorModule::StartupModule()
{
	FWaterUIStyle::Initialize();

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Editor/Private/WaterEditorModule.cpp:38

Scope (from outer to inner):

file
namespace    WaterEditorModule

Source code excerpt:

{
	static TAutoConsoleVariable<float> CVarOverrideNewWaterZoneScale(TEXT("r.Water.WaterZoneActor.OverrideNewWaterZoneScale"), 0, TEXT("Multiply WaterZone actor extent beyond landscape by this amount. 0 means no override."));
	static TAutoConsoleVariable<float> CVarOverrideNewWaterZoneMinimumMargin(TEXT("r.Water.WaterZoneActor.OverrideNewWaterZoneMinimumMargin"), 0, TEXT("Enforce a minimum distance between landscape and the WaterZone actor extent. 0 means no override."));
}

void FWaterEditorModule::StartupModule()
{
	FWaterUIStyle::Initialize();

#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Editor/Private/WaterEditorModule.cpp:294

Scope (from outer to inner):

file
function     void FWaterEditorModule::OnLevelActorAddedToWorld

Source code excerpt:


							float ZoneExtentScale = WaterEditorModule::CVarOverrideNewWaterZoneScale.GetValueOnGameThread();
							const float MinimumMargin = WaterEditorModule::CVarOverrideNewWaterZoneMinimumMargin.GetValueOnGameThread();

							if (ZoneExtentScale == 0)
							{
								ZoneExtentScale = GetDefault<UWaterEditorSettings>()->WaterZoneActorDefaults.NewWaterZoneScale;
							}