Reading the water from Blueprint
DRW answers “where is the water surface here, and how is it moving?” from any Blueprint, with no component needed. Use it for markers that sit on the waves, fishing floats, AI boats, swimming and underwater checks, or to place things on the surface.
Which node to use
Section titled “Which node to use”| Node | Use it for | Category |
|---|---|---|
| Get Water Surface At Location | Reading the surface every frame from any Blueprint. The simple choice. | DRW Water Surface |
| Query Water Surface (async) | One answer for one point, with an event when it arrives. | DRW Water Surface |
| Get Water Body At Location | Which pool, lake or river contains a 3D point. | DRW WaterBody |
| DRW Water Surface Subsystem functions | Explicit control: your own long-lived probes, water bodies only, or a requester other than self. | DRW Water Surface |
All of them work on the ocean and on DRW rivers, pools and lakes:
- Rivers, pools and lakes answer immediately.
- The ocean answers one or two frames after you ask, and the answer describes where the point was then. The very first answer for a new caller is not valid yet. While a DRW Water Time track drives the water in Sequencer, ocean answers are from the same frame (except on network clients).
Where a pool, lake or river covers a point, its surface is returned, not the ocean’s. Each machine answers from its own water; nothing is sent over the network.
The water surface sample
Section titled “The water surface sample”Every node returns the same struct, FDRWWaterSurfaceSample (reference):
| Field | Type | Meaning |
|---|---|---|
| Valid | bool | False until the first ocean answer arrives, or when there is no water at the point. Check it before using the rest. |
| Height | float (cm) | World Z of the water surface. On the ocean it includes the waves, ripples and wakes from floating objects, and shoreline surf. |
| Normal | vector | Surface normal (unit length). |
| Velocity | vector (cm/s) | In a river: the local current. On the ocean: the horizontal part is how the waves move the water at this point (plus the outflow current near the mouth of a river that flows into the sea), and the vertical part is how fast the surface rises or falls. The vertical part is zero in the first ocean answers. |
| Age | float (s) | How old an ocean answer is (one or two frames). Zero for rivers, pools and lakes. |
| Water Body | water body | The pool, lake or river the sample came from. None for the ocean. |
Get Water Surface At Location
Section titled “Get Water Surface At Location”Get Water Surface At Location (Blueprint function library, category DRW Water Surface). Call it every frame, for example on Tick.
| Pin | Type | Meaning |
|---|---|---|
| Location | vector | World position. Only X and Y are used. |
| Channel | int (default 0) | Use a different channel for each point when one Blueprint samples several points (0, 1, 2…). |
| Out Sample | sample struct | The answer. |
| Return Value | bool | True when Out Sample holds a valid surface. |
How it behaves:
- On rivers, pools and lakes it answers in the same frame.
- On the ocean, each caller (the Blueprint that calls it) and channel gets its own ocean probe, created on the first call. That first call returns false; answers follow one or two frames later and keep trailing the position by one or two frames as it moves.
- If a caller stops asking on a channel for more than about 2 seconds, or is destroyed, its probe is released. The next call starts over and is invalid again for a frame or two.
- Without an ocean in the level, points outside every water body never return a valid answer.
C++: UDRW_BlueprintLibrary::GetWaterSurfaceAtLocation(const UObject* WorldContextObject, FVector Location, FDRWWaterSurfaceSample& OutSample, int32 Channel = 0), declared in DRW_BlueprintLibrary.h.
Query Water Surface (async)
Section titled “Query Water Surface (async)”Query Water Surface gives one answer for one point and fires an event when it is ready. Like other async nodes, it goes in an Event Graph.
| Pin | Type | Meaning |
|---|---|---|
| Location | vector | World position. Only X and Y are used. |
| Timeout Seconds | float (default 1.0) | How long to wait for the ocean answer before failing. |
| On Sampled | exec + Sample | Fires with the answer. For a river, pool or lake it fires right away. For the ocean it fires once an answer taken at exactly this point is ready. |
| On Failed | exec + Sample | Fires when the answer does not arrive within the timeout (for example, with no ocean and no water body at the point), or when the level’s water sample budget is full. The sample is empty. |
Get Water Body At Location
Section titled “Get Water Body At Location”Get Water Body At Location (pure, category DRW WaterBody) returns the pool, lake or river whose water contains a 3D point, or none.
- Z matters: the point must be under that water’s surface, inside its area and not far below its bottom. A point above the water returns none.
- It never returns the ocean. To test the ocean, compare the point’s Z with the Height from Get Water Surface At Location.
The DRW Water Surface Subsystem
Section titled “The DRW Water Surface Subsystem”For explicit control, get the DRW Water Surface Subsystem node (search the Blueprint menu for “Water Surface Subsystem”) and call its functions. In C++: GetWorld()->GetSubsystem<UDRW_WaterSurfaceSubsystem>() from Physics/DRW_WaterSurfaceSubsystem.h (reference).
| Function | What it does |
|---|---|
| Get Water Surface (Requester, Location, Out Sample, Channel) | The same as Get Water Surface At Location, with the requester as an explicit pin. Each requester and channel keeps its own ocean probe. |
| Create Water Probe (Location) | Starts tracking the surface at a point and returns a probe handle, or -1 when the level’s water sample budget is full. |
| Set Water Probe Location (Probe, Location) | Moves a probe. The ocean answer for the new point arrives one or two frames later. |
| Get Water Probe Sample (Probe, Out Sample) | The probe’s latest answer. Returns false while none is available. |
| Destroy Water Probe (Probe) | Releases a probe. |
| Sample Water Body Surface (Location, Out Sample) | An instant answer from rivers, pools and lakes only. Returns false when no water body covers the point. |
Probes you create yourself never expire: destroy them when you are done (for example in End Play).
Ocean probes and Get Water Surface channels share the level’s water sample budget with floating objects. It is set with the console variable drw.WaterQuery.MaxQueries (default 4096, 256 to 8192, read when the world starts). When it is full, Create Water Probe returns -1 and Query Water Surface fires On Failed.
Related: Is DRW Ready (category DRW Ocean) returns true once the ocean has finished starting up (its grid spawned and its depth map ready).
Typical uses
Section titled “Typical uses”A marker that rides the waves
Section titled “A marker that rides the waves”- On Tick, call Get Water Surface At Location with the actor’s location.
- If the return value is true, set the marker’s world Z to Height plus the offset you want above the surface.
- To tilt it with the waves, build its rotation from Normal (for example with Make Rot from Z).
A fishing float
Section titled “A fishing float”- With physics: make a small actor with a DRW Physics Body (one Plastic or Wood sphere, like
BP_FloatSphere) and DRW Buoyancy. It bobs, tilts and drifts with currents on its own, and you can pull it with a cable or physics constraint. See Making objects float. - Without physics: on Tick, set the float’s Z to Height minus how deep it should sit, and its rotation from Normal. Add Velocity times the frame time to its position if it should drift with a river. Give each float in one Blueprint its own Channel.
AI boats
Section titled “AI boats”- Sample a few points around the boat (bow, stern, left, right) with one channel each. The differences in Height tell you how steep the waves are; Velocity tells you which way a river’s current is pushing.
- Boats built on DRW Buoyancy, including DRW’s own, also expose Is In Water and Buoyancy Outputs on that component (see Outputs for gameplay).
Swimming and underwater checks
Section titled “Swimming and underwater checks”- Is a point under water? Compare its Z with Height at its X and Y. Below the surface means under water.
- Which water is it in? Get Water Body At Location returns the pool, lake or river, or none on the ocean.
- Is a physics object in the water? Read Is In Water on its DRW Buoyancy component.
Placing something on the surface once
Section titled “Placing something on the surface once”Run Query Water Surface for the point, and spawn or move the object at Height in On Sampled.