Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


BuoyancyEffector2D

Applies forces to simulate buoyancy, fluid-flow and fluid drag.
Read time 7 minutesLast updated 2 days ago

Definition

public class BuoyancyEffector2D : Effector2D

Remarks

When any Collider2D overlap the area defined by the effector, calculations are made to determine if they are below the BuoyancyEffector2D.surfaceLevel. If they are not, no forces are applied. If they are then the effector will apply buoyancy forces in an attempt to move the Collider2D to the BuoyancyEffector2D.surfaceLevel i.e. they will float.
This effector is designed primarily to work with Collider2D that are set as triggers so that Collider2D can overlap the defined area and have buoyancy forces applied to them.

Properties

Property

Description

angularDragA force applied to slow angular movement of any Collider2D in contact with the effector.
densityThe density of the fluid used to calculate the buoyancy forces.
flowAngleThe angle of the force used to similate fluid flow.
flowMagnitudeThe magnitude of the force used to similate fluid flow.
flowVariationThe random variation of the force used to similate fluid flow.
linearDragA force applied to slow linear movement of any Collider2D in contact with the effector.
surfaceLevelDefines an arbitrary horizontal line that represents the fluid surface level.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.