Log inGet started
World

Tidewater: Oceans, Lakes, Rivers, Waterfalls, Swimming and Splashes Water Kit

Branchmain
Commit431c1b9967

README.md

riverPath

Spline, ribbon and flow-field helpers for running water, used by the river, stream and waterfall kinds (and by anything else that needs water laid along a path).

  • RiverPath.parse(path): points from "x,y,z; x,y,z" text or a list of {x,y,z}.
  • RiverPath.build(points, opts): a centripetal Catmull-Rom centreline through the points (upstream first), resampled every step metres, heights held non-increasing downstream (or laid on a groundY(x, z) probe plus groundOffset), with per-sample tangent, side, arc length, slope, Manning current (flowScale, roughness, clamped to minSpeed..maxSpeed), rapids amount (rapids, rapidsSlope), width (with widthVariation) and depth.
  • RiverPath.manning(depth, slope, roughness?): surface speed of a wide channel.
  • RiverPath.ribbon(path, { cross, stride, bankDrop }): the water mesh: uv = (metres across, metres along), vertex colour = (speed/10, rapids, slope*5, across 0..1), tangent = downstream.
  • RiverPath.bedMesh(path, { bankWidth, bankHeight, cross, stride }): a carved channel and banks for a river standing where no terrain was cut for it.
  • RiverPath.waterGrid(path, opts): a Physics.defineWater grid body: level, bed and a per-texel flow (x, z m/s) along the channel, fastest mid-stream, so Physics.water, FluidForces and Buoyancy carry bodies downstream.
  • RiverPath.nearest(path, x, z): the nearest sample and the offset across/along it.