Skip to content

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 ​

cpp
FluidMedium medium

The liquid.

surfaceHeight ​

cpp
double surfaceHeight

Height of the free surface [m].

bottomHeight ​

cpp
double bottomHeight

Height of the bottom [m].

min ​

cpp
Vec<2> min

Lower horizontal corner (x, y) [m].

max ​

cpp
Vec<2> max

Upper horizontal corner (x, y) [m].

waveRadiation ​

cpp
double waveRadiation

Scale 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 ​

cpp
std::vector<FluidWave> waves

Waves on the surface; their motion adds to medium.velocity. A sampler takes their place.

sampler ​

cpp
std::function<FluidSample(const Vec<3> &point)> sampler

Optional: 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.

RaiSim — physics for robotics and AI.