Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

BuoyancyInput

struct in Unity.U2D.Physics

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Input to PhysicsBody.ApplyBuoyancy describing the fluid surface, density, flow and damping used to compute buoyancy, flow and damping forces for the body.

Properties

Property Description
angularDamping Angular damping coefficient. Slows the body's angular velocity while submerged.
density The fluid density, used to compute the Archimedean buoyancy force per submerged unit area. Clamped to a lower bound of Mathf.Epsilon.
flowDirection The direction of the fluid flow as a 2D rotation. Combined with PhysicsBody.BuoyancyInput.flowSpeed to produce the flow velocity vector applied as force per unit submerged area at the submerged centroid.
flowSpeed The magnitude of the fluid flow along PhysicsBody.BuoyancyInput.flowDirection. The per-shape force contribution is flowDirection " flowSpeed " submergedArea.
linearDamping Linear damping coefficient. Slows the body's linear velocity at the submerged centroid relative to the fluid.
mask Category mask used to filter which attached shapes contribute. A shape participates iff (shape.contactFilter.categories.bitMask & mask.bitMask) != 0. Defaults to PhysicsMask.All when the input is created via the parameterless constructor.
surfaceNormal The outward-pointing surface normal of the fluid, in world space. Points away from the submerged side; shape points with a negative separation from the plane are submerged. Defaults to Vector2.up (a flat horizontal water surface). Must be non-zero; the engine normalises it internally so it does not need to be unit length.
surfacePosition A point in world space lying on the fluid surface. Together with PhysicsBody.BuoyancyInput.surfaceNormal this defines the infinite plane of the fluid.
useTriggers When true, trigger shapes contribute to buoyancy alongside solid shapes. When false, trigger shapes are skipped.

Constructors

Constructor Description
PhysicsBody.BuoyancyInput Create a default BuoyancyInput. The PhysicsBody.BuoyancyInput.mask defaults to PhysicsMask.All so every attached shape contributes unless explicitly filtered out. The surface defaults to a flat horizontal water surface at the world origin (PhysicsBody.BuoyancyInput.surfacePosition = Vector2.zero, PhysicsBody.BuoyancyInput.surfaceNormal = Vector2.up).