BuoyancyEffector2D
Applies forces to simulate buoyancy, fluid-flow and fluid drag.
Read time 7 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.Physics2DModule
- Inherits from: Effector2D
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 |
|---|---|
| angularDrag | A force applied to slow angular movement of any Collider2D in contact with the effector. |
| density | The density of the fluid used to calculate the buoyancy forces. |
| flowAngle | The angle of the force used to similate fluid flow. |
| flowMagnitude | The magnitude of the force used to similate fluid flow. |
| flowVariation | The random variation of the force used to similate fluid flow. |
| linearDrag | A force applied to slow linear movement of any Collider2D in contact with the effector. |
| surfaceLevel | Defines an arbitrary horizontal line that represents the fluid surface level. |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |