Using the Buoyancy Effector 2D, you can define simple fluid behaviour such as floating and the drag and flow of fluid. You can also control a fluid surface, with the fluid behaviour taking place below.
Property: | Function: |
---|---|
Use Collider Mask | Should the ‘Collider Mask’ property be used? Check the box for yes. If not then the global collision matrix will be used as is the default for all colliders. |
Collider Mask | The mask used to select specific layers allowed to interact with the effector. Note that this option only displays if you have selected Use Collider Mask. |
Surface Level | Defines the surface of the buoyancy fluid. When an object is above this line, no forces are applied. When an object is intersecting or completely below this line, forces are applied. This is a location specified as a world-space offset, along the world Y-Axis, but is also scaled by the object’s Transform component. |
Density | The density of the effector fluid, which affects the behaviour of Colliders: Those with a higher density sink, with a lower density float, and those with the same density ‘hang’ in the fluid. |
Linear Drag | The drag coefficient affecting positional movement of an object - it only applies when inside the fluid. |
Angular Drag | The drag coefficient affecting rotational movement of an object - it only applies when inside the fluid. |
Flow Angle | The world-space angle (in degrees) for the direction of fluid flow. Fluid flow applies forces in the specified direction. |
Flow Magnitude | The “power” of the fluid flow force. Combined with Fluid Angle, this specifies the level of force applied to objects inside the fluid. The magnitude can also be negative, in which case, the forces are applied at 180 degrees to the Flow Angle. |
Flow Variation | Enter a value here to randomly vary the fluid forces. You can specify a positive or negative variation to randomly add or subtract from the Fluid Magnitude. |