Skip to content

BuoyancyZoneComponent Class

Marks a trigger PhysicsBodyComponent as a fluid zone that applies buoyancy, linear drag, and optional flow forces to overlapping dynamic bodies each fixed-update tick.

public class BuoyancyZoneComponent : Brine2D.ECS.Component

Inheritance System.ObjectComponent → BuoyancyZoneComponent

Remarks

The entity must also have a PhysicsBodyComponent with IsTrigger = true. The BuoyancySystem handles force application automatically when added to the scene.

Submersion fraction is estimated via AABB intersection between the zone and each body. This is fast and accurate for axis-aligned rectangular bodies but will over- or under-estimate for rotated, circular, or non-rectangular shapes. For most gameplay use cases the approximation is imperceptible.

Properties
FlowVelocity Bulk velocity of the fluid in pixels per second. Non-zero values push overlapping bodies in the flow direction (e.g. rivers, currents). Default is System.Numerics.Vector2.Zero.
FluidDensity Density of the fluid relative to the default body density. A value of 1 neutrally suspends a body with density 1; greater than 1 causes bodies to float, less than 1 causes them to sink. Default is 1.
LinearDrag Drag coefficient applied to the relative velocity between the body and the fluid. Higher values dampen motion more aggressively. Default is 1.