Class SurfaceWater
The open water in the loaded scene — a sea, its lakes and rivers: where anything falling out of the sky stops, whether a point is under a surface, and how high the water stands at a place.
public static class SurfaceWater
- Inheritance
-
SurfaceWater
- Inherited Members
Remarks
A sea has nothing to hit. The weather finds the highest surface around the camera by casting rays down, and a ray goes straight through water to the sea bed. So rain and snow fell through the sea and landed on the sand under it, splashes burst on the bottom, and the lens kept its raindrops with the camera three metres down. Wherever the ground is lower than the water, the water is the highest surface.
Published by the water, read by the weather. The water depends on the game and never the other way round, so the weather cannot ask it — each body of water registers itself here, the way the server registers its weather host into WeatherTimelines.Commands.
One sea, any number of inland waters. The sea stands at one level everywhere its ground is lower (TryGetLevel(out float)). A lake or a river stands only where it is (SurfaceWater.IAreaSource), so the question that covers both is the water at a place: TryGetSurfaceAt(float, float, out float).
Fields
FloorReach
How far over a height a body's floor may lie and the height still be in or over that body, metres (2026-10-21): a swimmer's feet, a footstep, a camera stand at most this far under the bed of the water they are in.
public const float FloorReach = 1
Field Value
Properties
DaylightExtinction
How fast the sea dims the daylight with depth, per metre (SurfaceWater.IDaylightSource), or 0 with no sea or none set.
public static float DaylightExtinction { get; }
Property Value
Present
True while the scene has any open water.
public static bool Present { get; }
Property Value
Version
Moves whenever a body of water joins or leaves: what a cache of answers about the water keys on.
public static int Version { get; }
Property Value
WaveHeight
The significant height of the sea's waves, or 0 with no sea.
public static float WaveHeight { get; }
Property Value
Methods
CurrentAt(float, float)
The water's horizontal velocity at a world position, m/s: a river's current; zero on the sea, a lake or dry ground.
public static Vector2 CurrentAt(float x, float z)
Parameters
Returns
- Vector2
IsUnder(Vector3)
True when a point is under any water's moving surface.
public static bool IsUnder(Vector3 point)
Parameters
pointVector3
Returns
Register(ISource)
Adds a body of water to the scene's.
public static void Register(SurfaceWater.ISource water)
Parameters
waterSurfaceWater.ISource
TryGetInlandSurfaceAt(float, float, out float)
The highest lake or river surface over a world position, leaving the sea out: for maps that bake what stands where, which must not bake the sea's level, since the tide moves it every frame.
public static bool TryGetInlandSurfaceAt(float x, float z, out float level)
Parameters
Returns
TryGetInlandSurfaceAt(float, float, out float, out bool)
TryGetInlandSurfaceAt(float, float, out float), and whether the highest inland surface there is molten lava (SurfaceWater.ILavaAreaSource) rather than water.
public static bool TryGetInlandSurfaceAt(float x, float z, out float level, out bool lava)
Parameters
Returns
TryGetLevel(out float)
The sea's still surface, tide included, when there is a sea.
public static bool TryGetLevel(out float level)
Parameters
levelfloat
Returns
TryGetSurfaceAt(float, float, out float)
The highest still water surface over a world position: the sea's level, or a lake's or a river's where one stands. False where there is none — though the sea's level is returned anywhere when there is a sea, as it always was: whether the ground there is under it is the caller's to compare.
public static bool TryGetSurfaceAt(float x, float z, out float level)
Parameters
Returns
Unregister(ISource)
Withdraws a body of water.
public static void Unregister(SurfaceWater.ISource water)
Parameters
waterSurfaceWater.ISource
WaveOffsetAt(float, float)
How far the drawn waves stand above (or below) the still water at a world position, metres: the sea's waves where the sea is the water there, 0 under a lake or a river standing higher, on calm water, or with no sea.
public static float WaveOffsetAt(float x, float z)
Parameters
Returns
Remarks
Presentation only. The movement floats on the still surface (WaterQuery, a synced tick and no waves, so the server and every client agree); a figure drawn on that line sits still while the sea heaves through it. Added to the still line, this is the drawn sea at the point: the figure rides the waves the player sees. It reads the frame's camera and clock, so it is never for anything simulated.