Skip to content

Wave Surface

WaveSurface generates and animates the visible water mesh. It also exposes sampling methods used by buoyancy objects.

Required Components

WaveSurface requires:

  • MeshFilter
  • MeshRenderer

These are added automatically by the setup menu.

Fields

Field Description
Profile The WaveProfile used to shape the water.
Size Width and depth of the generated water mesh.
Resolution Number of grid subdivisions per side. Higher values look smoother but cost more CPU.
Update In Edit Mode Animates the mesh in edit mode when enabled.
Animate Enables or disables time-based wave animation.
Time Scale Scales water animation speed.

Public Sampling

WaveSurface can sample the water at any world position:

float height = surface.GetHeight(worldPosition);
Vector3 normal = surface.GetNormal(worldPosition);
WaveSample sample = surface.Sample(worldPosition);

WaveBuoyancy uses these methods internally.

Performance Notes

  • Start with Resolution around 64-80.
  • Use larger mesh size for open scenes.
  • For very large environments, prefer multiple surfaces or a shader-based extension later.