UWaterBodyComponent

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Water

Header

/Engine/Plugins/Experimental/Water/Source/Runtime/Public/WaterBodyComponent.h

Include

#include "WaterBodyComponent.h"

Syntax

UCLASS(Abstract,
       HideCategories=(Tags, Activation, Cooking, Replication, Input, AssetUserData, Mesh))
class UWaterBodyComponent : public UPrimitiveComponent

Variables

Name Description

Public variable UProperty Category, EditAnywhere BlueprintReadWrite

bool

 

bAffectsLandscape

If enabled, landscape will be deformed based on this water body placed on top of it and landscape height will be considered when determining water depth at runtime

Protected variable UProperty Category, EditAnywhere, Meta BlueprintReadWrite

bool

 

bCanAffectNavigation

Public variable UProperty Category, EditAnywhere, Meta

bool

 

bFillCollisionUnderWaterBodiesForNavmesh

Prevent navmesh generation under the water geometry

Public variable UProperty Category, EditAnywhere BlueprintReadOnly

bool

 

bGenerateCollisions

If true, one or more collision components associated with this water will be generated.

Protected variable UProperty Category, EditAnywhere BlueprintReadOnly

bool

 

bOverrideWaterMesh

TODO [jonathan.bard] : make sure override water mesh works for all types.

Public variable UProperty Category, EditAnywhere, AdvancedDisplay BlueprintReadWrite

float

 

CollisionHeightOffset

The distance above the surface of the water where collision checks should still occur.

Protected variable UProperty Category, EditAnywhere, Meta BlueprintReadOnly

FName

 

CollisionProfileName

Protected variable UProperty Transient

FPostProcessSet...

 

CurrentPostProcessSettings

Public variable UProperty Category, EditAnywhere BlueprintReadWrite

FWaterCurveSett...

 

CurveSettings

Protected variable UProperty Category, AdvancedDisplay editinstanceonly

TArray< TLazyOb...

 

ExclusionVolumes

Protected variable UProperty Category, AdvancedDisplay editinstanceonly

TArray< TLazyOb...

 

Islands

Islands in this water body

Protected variable UProperty Transient

TWeakObjectPtr<...

 

Landscape

Public variable UProperty Category, EditAnywhere BlueprintReadWrite

TMap< FName, FW...

 

LayerWeightmapSettings

Public variable UProperty Category, EditAnywhere

float

 

MaxWaveHeightOffset

Offset added to the automatically calculated max wave height bounds.

Protected variable UProperty Category, EditAnywhere, Meta BlueprintReadOnly

int32

 

OverlapMaterialPriority

Higher number is higher priority.

Public variable UProperty Category, EditDefaultsOnly, Meta

UPhysicalMateri...

 

PhysicalMaterial

Public variable UProperty Category, EditAnywhere, AdvancedDisplay BlueprintReadWrite

float

 

ShapeDilation

Public variable UProperty Category, EditAnywhere, Meta BlueprintReadWrite displayname

float

 

TargetWaveMaskDepth

Water depth at which waves start being attenuated.

Public variable UProperty Category, EditAnywhere, Meta BlueprintReadOnly

UMaterialInterf...

 

UnderwaterPostProcessMaterial

Post process material to apply when the camera goes underwater (only available when bGenerateCollisions is true because collisions are needed to detect if it's under water).

Protected variable UProperty Category, Meta Transient nonpieduplicatetransient, textexporttransient, visibleinstanceonly

UMaterialInstan...

 

UnderwaterPostProcessMID

Public variable UProperty Category, EditAnywhere, Meta BlueprintReadWrite

FUnderwaterPost...

 

UnderwaterPostProcessSettings

Post process settings to apply when the camera goes underwater (only available when bGenerateCollisions is true because collisions are needed to detect if it's under water).

Protected variable UProperty Category BlueprintReadOnly Transient duplicatetransient, nontransactional, visibleanywhere

int32

 

WaterBodyIndex

Unique Id for accessing (wave, ... ) data in GPU buffers

Public variable UProperty Category, EditAnywhere BlueprintReadWrite

FWaterBodyHeigh...

 

WaterHeightmapSettings

Public variable UProperty Category, EditAnywhere BlueprintReadOnly

UMaterialInterf...

 

WaterMaterial

Protected variable UProperty Category, EditAnywhere, AdvancedDisplay BlueprintReadOnly

UStaticMesh ...

 

WaterMeshOverride

Protected variable UProperty Category, Meta Transient nonpieduplicatetransient, textexporttransient, visibleinstanceonly

UMaterialInstan...

 

WaterMID

Protected variable UProperty Category, EditAnywhere, Meta BlueprintReadWrite

TSubclassOf< UN...

 

WaterNavAreaClass

The navigation area class that will be generated on nav mesh.

Protected variable UProperty Transient

UWaterSplineMet...

 

WaterSplineMetadata

Constructors

Name Description

Public function

UWaterBodyComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

AddExclusionVolume

(
    AWaterBodyExclusionVolume* InE...
)

Adds WaterBody exclusion volume

Public function

void

 

AddIsland

(
    AWaterBodyIsland* Island
)

Public function Virtual Const

bool

 

AffectsLandscape()

Public function Virtual Const

bool

 

AffectsWaterMesh()

Protected function

void

 

ApplyNavigationSettings()

Protected function Virtual

void

 

BeginUpdateWaterBody()

Called every time UpdateAll is called on WaterBody (prior to UpdateWaterBody)

Protected function Virtual Const

bool

 

CanAffectNavigation()

Returns whether the body affects navigation

Public function Virtual Const

bool

 

CanAffectWaterMesh()

Protected function Const

EWaterBodyQu...

 

CheckAndAjustQueryFlags

(
    EWaterBodyQueryFlags InQueryFlags
)

Protected function Virtual Const

TArray< TSha...

 

CheckWaterBodyStatus()

Public function Const

bool

 

ContainsExclusionVolume

Public function Const

bool

 

ContainsIsland

(
    TLazyObjectPtr< AWaterBodyIsland > ...
)

Protected function

void

 

CreateOrUpdateUnderwaterPostProcessMID()

Protected function

void

 

CreateOrUpdateWaterMID()

Public function Const

float

 

FindInputKeyClosestToWorldLocation

(
    const FVector& WorldLocation
)

Spline query helper.

Public function Virtual Const

ALandscapePr...

 

FindLandscape()

Public function Virtual Const

float

 

GetAudioIntensityAtSplineInputKey

(
    float InKey
)

Public function Virtual Const

TArray< UPri...

 

GetBrushRenderableComponents()

Public function Virtual Const

void

 

GetBrushRenderDependencies

(
    TSet< UObject* >& OutDependen...
)

Public function Virtual Const

ETextureRend...

 

GetBrushRenderTargetFormat()

Public function Const

float

 

GetChannelDepth()

Returns channel depth

Public function Virtual Const

FBox

 

GetCollisionComponentBounds()

Returns the body's collision component bounds

Public function Virtual Const UFunction BlueprintCallable, Category

TArray< UPri...

 

GetCollisionComponents()

Returns body's collision components

Public function Virtual Const

FVector

 

GetCollisionExtents()

Returns collision extents (For internal use. Please use AWaterBodyOcean instead.)

Public function Const

FName

 

GetCollisionProfileName()

Returns collision profile name

Public function Virtual Const

float

 

GetConstantDepth()

Returns what can be considered the single water depth of the water surface.

Public function Virtual Const

float

 

GetConstantSurfaceZ()

Returns what can be considered the single base Z of the water surface.

Public function Virtual Const

FVector

 

GetConstantVelocity()

Returns what can be considered the single water velocity of the water surface.

Public function Const UFunction BlueprintCallable, Category

TArray< AWat...

 

GetExclusionVolumes()

Gets the exclusion volume that influence this water body

Public function Virtual Const

float

 

GetHeightOffset()

Returns the additional water height added to the body (For internal use. Please use AWaterBodyOcean instead.)

Public function Const UFunction BlueprintCallable, Category

TArray< AWat...

 

GetIslands()

Gets the islands that influence this water body

Public function Const

const TMap< ...

 

GetLayerWeightmapSettings()

Public function Const UFunction BlueprintCallable, Category

float

 

GetMaxWaveHeight()

Returns the max height that this water body's waves can hit.

Protected function Const

TSubclassOf<...

 

GetNavAreaClass()

Returns navigation area class

Public function Const

int32

 

GetOverlapMaterialPriority()

Returns overlap material priority

Public function Const

FPostProcess...

 

GetPostProcessProperties()

Returns post process properties

Public function Virtual UFunction BlueprintCallable, Category

UMaterialIns...

 

GetRiverToLakeTransitionMaterialInstance()

Returns River to lake transition material instance (For internal use. Please use AWaterBodyRiver instead.)

Public function Virtual UFunction BlueprintCallable, Category

UMaterialIns...

 

GetRiverToOceanTransitionMaterialInstance()

Returns River to ocean transition material instance (For internal use. Please use AWaterBodyRiver instead.)

Protected function Virtual Const

float

 

GetSimpleWaveHeightAtPosition

(
    const FVector& InPosition,
    float InWaterDepth,
    float InTime
)

Computes the raw wave perturbation of the water height only (simple version : faster computation)

Public function Virtual Const UFunction BlueprintCallable, Category

TArray< UPri...

 

GetStandardRenderableComponents()

Retrieves the list of primitive components that this water body uses when not being rendered by the water mesh (e.g. the static mesh component used when WaterMeshOverride is specified)

Public function Virtual Const

void

 

GetSurfaceMinMaxZ

(
    float& OutMinZ,
    float& OutMaxZ
)

Returns the minimum and maximum Z of the water surface, including waves

Protected function Const

EObjectFlags

 

GetTransientMIDFlags()

Public function UFunction BlueprintCallable, Category

UMaterialIns...

 

GetUnderwaterPostProcessMaterialInstance()

Returns under water post process MID

Public function Const UFunction BlueprintCallable, Category

AWaterBody &...

 

GetWaterBodyActor()

Returns the WaterBodyActor who owns this component

Public function Const

int32

 

GetWaterBodyIndex()

Returns the unique id of this water body for accessing data in GPU buffers

Public function Virtual Const

EWaterBodyTy...

 

GetWaterBodyType()

Returns the type of body

Public function Const

const FWater...

 

GetWaterCurveSettings()

Public function Const

const FWater...

 

GetWaterHeightmapSettings()

Public function Const UFunction BlueprintCallable, Category

UMaterialInt...

 

GetWaterMaterial()

Returns water material

Public function UFunction BlueprintCallable, Category

UMaterialIns...

 

GetWaterMaterialInstance()

Returns water MID

Public function Const

UStaticMesh ...

 

GetWaterMeshOverride()

Returns water mesh override

Public function Const

FVector

 

GetWaterNavCollisionOffset()

Returns nav collision offset

Public function Const UFunction BlueprintCallable, Category

UWaterSpline...

 

GetWaterSpline()

Returns water spline component

Public function

UWaterSpline...

 

GetWaterSplineMetadata()

Returns water spline metadata

Public function Const

const UWater...

 

GetWaterSplineMetadata()

Returns water spline metadata

Public function Const UFunction BlueprintCallable, Category

void

 

GetWaterSurfaceInfoAtLocation

(
    const FVector& InLocation,
    FVector& OutWaterSurfaceLocation,
    FVector& OutWaterSurfaceNormal,
    FVector& OutWaterVelocity,
    float& OutWaterDepth,
    bool bIncludeDepth
)

Public function Virtual Const UFunction BlueprintCallable, Category

float

 

GetWaterVelocityAtSplineInputKey

(
    float InKey
)

Spline queries specific to metadata type

Public function Virtual Const

FVector

 

GetWaterVelocityVectorAtSplineInputKey

(
    float InKey
)

Public function Const UFunction BlueprintCallable, Category

UWaterWavesB...

 

GetWaterWaves()

Protected function Virtual Const

float

 

GetWaveAttenuationFactor

(
    const FVector& InPosition,
    float InWaterDepth
)

Computes the attenuation factor to apply to the raw wave perturbation.

Protected function Virtual Const

float

 

GetWaveHeightAtPosition

(
    const FVector& InPosition,
    float InWaterDepth,
    float InTime,
    FVector& OutNormal
)

Computes the raw wave perturbation of the water height/normal

Public function Const

bool

 

GetWaveInfoAtPosition

(
    const FVector& InPosition,
    float InWaterDepth,
    bool bInSimpleWaves,
    FWaveInfo& InOutWaveInfo
)

Fills wave-related information at the given world position and for this water depth.

Public function Virtual Const

float

 

GetWaveReferenceTime()

Returns the time basis to use in waves computation (must be unique for all water bodies currently, to ensure proper transitions between water tiles)

Public function Const

bool

 

HasWaves()

Returns true if there are valid water waves

Public function Virtual Const

bool

 

IsBodyDynamic()

Returns whether the body is baked (false) at save-time or needs to be dynamically regenerated at runtime (true) and is therefore transient.

Protected function Virtual Const

bool

 

IsFlatSurface()

Returns whether the body has a flat surface or not

Protected function Virtual Const

bool

 

IsHeightOffsetSupported()

Returns whether the body support a height offset

Protected function Virtual Const

bool

 

IsWaterSplineClosedLoop()

Returns whether the body's spline is closed

Public function Virtual Const

bool

 

IsWaveSupported()

Returns whether the body supports waves

Public function Const

bool

 

IsWorldLocationInExclusionVolume

(
    const FVector& InWorldLocation
)

Returns true if the location is within one of this water body's exclusion volumes

Protected function Virtual

void

 

OnPostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...,
    bool& bShapeOrPositionChanged,
    bool& bWeightmapSettingsChanged
)

Called by UWaterBodyComponent::PostEditChangeProperty.

Protected function

void

 

OnSplineDataChanged()

Protected function Virtual

void

 

OnUpdateBody

(
    bool bWithExclusionVolumes
)

Public function UFunction BlueprintCallable, Category

void

 

OnWaterBodyChanged

(
    bool bShapeOrPositionChanged,
    bool bWeightmapSettingsChanged
)

Protected function

void

 

OnWaterSplineMetadataChanged

(
    UWaterSplineMetadata* InWaterS...,
    FPropertyChangedEvent& PropertyCha...
)

Protected function

void

 

OnWavesDataUpdated

(
    UWaterWavesBase* InWaterWaves,
    EPropertyChangeType::Type InChangeT...
)

Protected function

void

 

PrepareCurrentPostProcessSettings()

Public function Virtual Const

FWaterBodyQu...

 

QueryWaterInfoClosestToWorldLocation

(
    const FVector& InWorldLocation,
    EWaterBodyQueryFlags InQueryFlags,
    const TOptional< float >& InSpline...
)

Returns the requested water info closest to this world location

Protected function

void

 

RegisterOnChangeWaterSplineMetadata

(
    UWaterSplineMetadata* InWaterS...,
    bool bRegister
)

Protected function

void

 

RegisterOnUpdateWavesData

(
    UWaterWavesBase* InWaterWaves,
    bool bRegister
)

Public function

void

 

RemoveExclusionVolume

(
    AWaterBodyExclusionVolume* InE...
)

Removes WaterBody exclusion volume

Public function

void

 

RemoveIsland

(
    AWaterBodyIsland* Island
)

Protected function

void

 

RequestGPUWaveDataUpdate()

Public function Virtual

void

 

Reset()

Public function Virtual

bool

 

SetDynamicParametersOnMID

(
    UMaterialInstanceDynamic* InMI...
)

Sets the dynamic parameters needed by the material instance for rendering.

Public function Virtual

bool

 

SetDynamicParametersOnUnderwaterPostProcessMID

(
    UMaterialInstanceDynamic* InMI...
)

Sets the dynamic parameters needed by the underwater post process material instance for rendering.

Public function Virtual

void

 

SetHeightOffset

(
    float InHeightOffset
)

Sets an additional water height (For internal use. Please use AWaterBodyOcean instead.)

Public function

void

 

SetUnderwaterPostProcessMaterial

(
    UMaterialInterface* InMaterial
)

Sets under water post process material

Public function

void

 

SetWaterMaterial

(
    UMaterialInterface* InMaterial
)

Sets water material

Public function

void

 

SetWaterMeshOverride

(
    UStaticMesh* InMesh
)

Sets the water mesh (when bOverrideWaterMesh is true of the for custom water body actors)

Public function Const

bool

 

ShouldGenerateWaterMeshTile()

Is this water body rendered with the WaterMeshComponent, with the quadtree-based water renderer?

Public function

void

 

UpdateAll

(
    bool bShapeOrPositionChanged
)

Public function Virtual

void

 

UpdateComponentVisibility

(
    bool bAllowWaterMeshRebuild
)

Updates the bVisible/bHiddenInGame flags on the component and eventually the child renderable components (e.g. custom water body)

Protected function

void

 

UpdateExclusionVolumes()

Public function

void

 

UpdateIslands()

Public function Virtual

void

 

UpdateMaterialInstances()

Creates/Destroys/Updates necessary MIDS

Protected function

void

 

UpdateSplineComponent()

Protected function Virtual

void

 

UpdateWaterBody

(
    bool bWithExclusionVolumes
)

Updates WaterBody (called 1st with bWithExclusionVolumes = false, then with true

Protected function

bool

 

UpdateWaterHeight()

Overridden from USceneComponent

Name Description

Protected function Virtual

bool

 

MoveComponentImpl

(
    const FVector& Delta,
    const FQuat& NewRotation,
    bool bSweep,
    FHitResult* Hit,
    EMoveComponentFlags MoveFlags,
    ETeleportType Teleport
)

Override this method for custom behavior for MoveComponent

Protected function Virtual

void

 

OnHiddenInGameChanged()

Overridable internal function to respond to changes in the hidden in game value of the component.

Protected function Virtual

void

 

OnVisibilityChanged()

Overridable internal function to respond to changes in the visibility of the component.

Overridden from UActorComponent

Name Description

Protected function Virtual

void

 

CheckForErrors()

Validates this component's data

Protected function Virtual

void

 

OnComponentDestroyed

(
    bool bDestroyingHierarchy
)

Called when a component is destroyed

Public function Virtual

void

 

OnRegister()

Component interface

Overridden from UObject

Name Description

Protected function Virtual Const

bool

 

CanEditChange

(
    const FProperty* InProperty
)

Called by the editor to query whether a property of this object is allowed to be modified.

Public function Virtual

void

 

PostDuplicate

(
    bool bDuplicateForPIE
)

Called after duplication & serialization and before PostLoad.

Protected function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Protected function Virtual

void

 

PostEditImport()

Called after importing property values for this object (paste, duplicate or .t3d import) Allow the object to perform any cleanup for properties which shouldn't be duplicated or are unsupported by the script serialization

Protected function Virtual

void

 

PostEditUndo()

Called after applying a transaction to the object.

Protected function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Protected function Virtual

void

 

PreEditUndo()

Called before applying a transaction to the object.

Protected function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Overridden from INavRelevantInterface

Name Description

Public function Virtual Const

FBox

 

GetNavigationBounds()

Get bounds for navigation octree

Public function Virtual Const

void

 

GetNavigationData

(
    FNavigationRelevantData& Data
)

INavRelevantInterface start.

Public function Virtual Const

bool

 

IsNavigationRelevant()

Are modifiers active?

Constants