Skip to content

Fluid Volume

Defines an area filled with a user-defined “fluid”. Combined with the Physics Influencer, this controls buoyancy for objects and triggers swimming animations on the player avatar.

Fluid-Volume-UI.png

Shape of the fluid zone:

  • Box
  • Sphere

Distance between the faces of the fluid zone along the local X (Width) and Z (Length) axes. Default is 10 meters at default scale.

“Depth” of the fluid zone along the local Y axis. Default is 5 meters at default scale.

Controls whether depth is measured from the center of the volume or from the center of the top face.

Controls the flowing force inside the volume (for example, a river or water cannon).

  • Directional: The entire volume flows in one direction defined by the Stream Angle.
  • Outward: Flows outward omnidirectionally from the origin.

Angle the stream flows toward in degrees. 0 is local +Z.

Force applied in the direction of the stream. Measured in newtons multiplied by the submerged volume of the affected object.

Density of the fluid in kg/L (multiplied by 1000 at runtime to get kg/m³). Default 1. A Physics Influencer uses this to compute buoyant mass.

Particle System emitted once per enter event, at the entering object’s position and with startSize set to the object’s bounds extent magnitude.

The volume sets the following properties on the renderer attached to the same GameObject (via a MaterialPropertyBlock) every frame:

PropertyDescription
_StreamDirectionWorld-space stream direction.
_StreamStrengthSigned stream strength.
_StreamTimeAccumulated stream time (for scrolling textures).

The collider runs on a generated child GameObject named FluidTrigger on layer 4. Box volumes create a BoxCollider sized (extend.x, depth, extend.y); sphere volumes create a SphereCollider of radius depth, with its parent scale forced to one * max(lossyScale) so it stays uniform.

GetStreamForce(pos) returns _streamDirection * streamStrength for Directional streams or (pos - position).normalized * streamStrength for Outwards streams. IsInside(point) implements the actual shape test (half-depth for Box with placeFromCenter, only the bottom half otherwise).

There are currently no examples. If you would like to add one, please contribute. Community contributions can be submitted to our Documentation GitHub.

  • CVR-GameFiles/ABI.CCK.Components/FluidVolume.cs