Skip to main content

Fluid Nodes

How to use fluids is covered in Fluids and the tutorial. This page lists the classes.

Fluid2D / Fluid3D

The base particle-fluid node.

PropertyTypeWhat it does
radiusfloatParticle radius. Must match physics/rapier/fluid/fluid_particle_radius_*.
densityfloatFluid density.
lifetimefloatSeconds before a particle despawns; 0 keeps them forever.
debug_drawboolDraw the particles for debugging.
effectsArray[Resource]Fluid effect resources, listed below.
pointsPackedVector2ArrayThe particles.
collision_layer / collision_maskintInteraction groups.
MethodWhat it does
get_points() / get_velocities() / get_accelerations()Per-particle state.
get_remaining_times()Per-particle time left before despawn.
create_rectangle_points(width, height)Generate a filled rectangle of particles.
create_circle_points(radius)Generate a filled circle of particles.

Shape helpers

Scripts in the addon folder that extend Fluid2D / Fluid3D and fill their points for you. Attach them to a fluid node; only the faucets are global classes.

Script / classProperties
fluid_2d_rectangle.gdwidth, height
fluid_2d_circle.gdcircle_radius
fluid_3d_box.gd / fluid_3d_sphere.gd3D equivalents
Faucet2D / Faucet3DSpawns particles over time: interval, max_particles, width, height

Effects

Resources added to a fluid's effects array:

ResourceEffect
FluidEffect2DElasticitySpringy, jelly-like behaviour.
FluidEffect2DSurfaceTensionAKINCI / HE / WCSPHSurface tension, three different models.
FluidEffect2DViscosityArtificial / DFSPH / XSPHViscosity, three different models.

All exist as FluidEffect3D* too.

Renderers

NodeWhat it does
Fluid2DRendererDraws each particle with a MultiMesh.
Fluid2DShaderRendererDraws the fluid with a metaball-style shader.
Fluid3DRenderer3D equivalent.