# ApplyBuoyancy

> Apply buoyancy, flow and damping forces to this shape based on how it is submerged in a fluid plane. Unlike PhysicsBody.ApplyBuoyancy, only this shape contributes to its owning body's buoyancy - sibling shapes on the same body are left alone. Forces and torques are continuous (not impulses), so this is expected to be called every simulation step. The shape's owning body must be PhysicsBody.BodyType.Dynamic; otherwise a warning is logged and the call is a no-op.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

## ApplyBuoyancy(BuoyancyInput, float)

Apply buoyancy, flow and damping forces to this shape based on how it is submerged in a fluid plane. Unlike [PhysicsBody.ApplyBuoyancy](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/applybuoyancy.md), only this shape contributes to its owning body's buoyancy - sibling shapes on the same body are left alone. Forces and torques are continuous (not impulses), so this is expected to be called every simulation step. The shape's owning body must be [PhysicsBody.BodyType.Dynamic](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/bodytype/dynamic.md); otherwise a warning is logged and the call is a no-op.

```csharp
public void ApplyBuoyancy(PhysicsBody.BuoyancyInput input, float deltaTime)
```

### Parameters

**** (\[BuoyancyInput]\(/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/buoyancyinput)): The fluid and force configuration. See [PhysicsBody.BuoyancyInput](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/buoyancyinput.md).**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The simulation step duration in seconds. Used to clamp damping so it cannot overshoot in a single step.

## ApplyBuoyancy(BuoyancyInput, ReadOnlySpan\<PhysicsShape>, float)

Apply buoyancy, flow and damping forces to every shape in `shapes` based on how each is submerged in a fluid plane. The same [PhysicsBody.BuoyancyInput](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/buoyancyinput.md) is applied to all listed shapes. Each shape's owning body must be [PhysicsBody.BodyType.Dynamic](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/bodytype/dynamic.md); shapes on non-dynamic or invalid bodies log a warning and are skipped. Per-body sleep/wake decisions and damping clamps aggregate only across the listed shapes for each body, so siblings not in `shapes` contribute nothing - this is the difference from [PhysicsBody.ApplyBuoyancy](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/applybuoyancy.md), which always processes every shape on each listed body. Forces and torques are continuous (not impulses), so this is expected to be called every simulation step.

```csharp
public static void ApplyBuoyancy(PhysicsBody.BuoyancyInput input, ReadOnlySpan<PhysicsShape> shapes, float deltaTime)
```

### Parameters

**** (\[BuoyancyInput]\(/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/buoyancyinput)): The fluid and force configuration. See [PhysicsBody.BuoyancyInput](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody/buoyancyinput.md).**** (\[ReadOnlySpan\<PhysicsShape>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The shapes that buoyancy should be applied to.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The simulation step duration in seconds. Used to clamp damping so it cannot overshoot in a single step.
