class

FWaterQuery

Module
SceneTypes
Header
#include "Water/WaterQuery.h"
Namespace
Mowo

Public functions

ReturnsNameDescription
FGerstnerWaveParamsMakeGerstnerParams
FGerstnerWaveParamsMakeBodyGerstnerParamsThe one place a WaterBodyComponent becomes wave parameters.
FWaterSurfaceSampleSampleWaterSurfaceHeight/normal (and river flow) of the topmost water surface over worldXZ.
boolGetWaterHeightAtGameplay entry points.
floatGetWaterDepthAt
Vec3GetWaterVelocityAt
boolIsUnderwaterTrue when worldPosition sits below the water surface covering it.
FWaterSurfaceSampleSurfaceInfoAtEverything at a point in one call — depth, flow, body id, wave height and the transition weight.
FWaterShoreSampleNearestShoreClosest point on the shoreline of the body covering the query.
floatTransitionWeightHow much of a body a query is, given how far inside its own shoreline the query sits.
voidBlendTierWeightsResolves a set of overlapping bodies into per-body shares that sum to one.
floatFlowMapHalfSizeHalf-side of the square a body's painted flow map covers, in body-local metres.
voidEnsureFlowMapDecodedDecodes the hex flow map into the component's runtime byte buffer if it is not already there.
Vec2SampleFlowMapThe painted current at a body-local XZ, m/s.

Function details

MakeGerstnerParams

C++
static FGerstnerWaveParams MakeGerstnerParams(const WaterComponent& wc)

MakeBodyGerstnerParams

C++
static FGerstnerWaveParams MakeBodyGerstnerParams(const WaterBodyComponent& wb)

The one place a WaterBodyComponent becomes wave parameters. The renderer and the query both go through it: two copies of this derivation is how the surface that floats things drifts from the surface that is drawn.

SampleWaterSurface

C++
static FWaterSurfaceSample SampleWaterSurface(World& world, const Vec2& worldXZ)

Height/normal (and river flow) of the topmost water surface over worldXZ. Considers both the global WaterComponent plane and spline WaterBodyComponent bodies; the highest covering surface wins.

GetWaterHeightAt

C++
static bool GetWaterHeightAt(World& world, const Vec3& worldPosition, float& outHeight)

Gameplay entry points. These are what a boat, a swim volume, a footstep surface query or a Visual Script graph should call — they hide the body walk and the Gerstner inversion behind the four questions gameplay actually asks.

GetWaterDepthAt

C++
static float GetWaterDepthAt(World& world, const Vec3& worldPosition)

GetWaterVelocityAt

C++
static Vec3 GetWaterVelocityAt(World& world, const Vec3& worldPosition)

IsUnderwater

C++
static bool IsUnderwater(World& world, const Vec3& worldPosition)

True when worldPosition sits below the water surface covering it. The renderer's underwater pass asks FWaterRenderState the same question against the published frame state; this one answers off the ECS, so it works on a dedicated server with no renderer at all.

SurfaceInfoAt

C++
static FWaterSurfaceSample SurfaceInfoAt(World& world, const Vec3& worldPosition)

Everything at a point in one call — depth, flow, body id, wave height and the transition weight. The four calls above are all this one, narrowed; gameplay and audio that want two of them should ask once.

NearestShore

C++
static FWaterShoreSample NearestShore(World& world, const Vec3& worldPosition)

Closest point on the shoreline of the body covering the query. Invalid outside every body: "the nearest water's edge to a point on dry land" would have to walk every body in the world, and nothing asks it.

TransitionWeight

C++
static float TransitionWeight(float shoreDistance, float transitionWidth)

How much of a body a query is, given how far inside its own shoreline the query sits. A width of zero is the pre-transition rule — the body owns its interior right up to its edge — and any positive width is a smooth handover over that many metres. Shared with the info-texture raster on purpose: the raster is a cache of this function, and two handover rules would put the drawn seam somewhere the buoyancy seam is not.

BlendTierWeights

C++
static void BlendTierWeights(const std::vector<float>& shoreDistances, const std::vector<float>& transitionWidths, const std::vector<int32_t>& priorities, std::vector<float>& outWeights)

Resolves a set of overlapping bodies into per-body shares that sum to one. Priority tiers are walked from the top down and each tier claims the share its strongest member is confident of: a body deep inside its own shoreline claims everything and the lower tiers never speak, while one standing in its own transition band leaves the rest of the answer to whatever it is running into. With every width at zero this is the old rule exactly — the top priority wins outright — so a scene that never touches Transition Width is unmoved. The gameplay query, the info raster and the per-vertex shading blend all call THIS. Three copies of a handover rule is three places for the drawn seam to end up somewhere the buoyancy seam is not.

FlowMapHalfSize

C++
static float FlowMapHalfSize(const WaterBodyComponent& wb)

Half-side of the square a body's painted flow map covers, in body-local metres. The paint tool, the info raster and the query all size the map with this one call — three copies of "how big is the body" is how a painted current ends up sampled at a different scale than it was drawn.

EnsureFlowMapDecoded

C++
static void EnsureFlowMapDecoded(WaterBodyComponent& wb)

Decodes the hex flow map into the component's runtime byte buffer if it is not already there. Cheap and idempotent: a size that already matches the resolution is the whole test.

SampleFlowMap

C++
static Vec2 SampleFlowMap(const WaterBodyComponent& wb, const Vec2& localXZ)

The painted current at a body-local XZ, m/s. Zero when nothing is painted, when the point is outside the map, or for a river (whose current is its spline tangent and must not be overridden by a stroke).

Generated from Water/WaterQuery.h via scenetypes.json · Nov 4, 2026Version 1.0.0