raisim::FluidVolume
struct · #include <raisim/Fluid.hpp>
A body of liquid under a free surface: a pool, a lake, the sea. It holds the collision shapes whose centroids lie within [min, max] horizontally and above its bottom (all infinite by default) and that reach below its surface, and the surface cuts them where they cross it. Its walls and bottom are meant to be solid: a shape that reaches through them is still wholly in the liquid up to the surface. Waves move its surface and the liquid under it; a sampler gives it a surface and currents that vary from place to place in any other way.
Public attributes
medium
FluidMedium mediumThe liquid.
surfaceHeight
double surfaceHeightHeight of the free surface [m].
bottomHeight
double bottomHeightHeight of the bottom [m].
min
Vec<2> minLower horizontal corner (x, y) [m].
max
Vec<2> maxUpper horizontal corner (x, y) [m].
waveRadiation
double waveRadiationScale of the damping of the waves a floating body makes as it bobs (heave radiation damping): the waves carry its energy away, so that it settles in a few periods. 0 turns it off.
waves
std::vector<FluidWave> wavesWaves on the surface; their motion adds to medium.velocity. A sampler takes their place.
sampler
std::function<FluidSample(const Vec<3> &point)> samplerOptional: the surface and the velocity of the liquid around a point, in place of surfaceHeight and medium.velocity: a wave field or a simulated river (for example rayrai's sampleWaterSurface() or sampleWaterFlow()). Each step calls it once for every collision body in the volume's horizontal bounds, at the centroid of the body, on the thread that steps the world; the surface is taken as the plane through the sample with its normal over the body. The result must depend only on the point and the state of the simulation for the world to stay deterministic.