Vixen
c7401864
csharp
public struct BuoyancyState

What the last fixed step did to a floating body.

Read the guide page for this →

As a scene component

Size
20 bytes — 512 rows in a 16 KB chunk, alone on the archetype

Remarks

A readout and not an input. BuoyancySystem writes it every step and nothing reads it to decide anything — which is exactly why it exists: a boat that sits too low, launches out of the lake or drifts sideways is a bug with no visible cause, and these five numbers are the difference between "buoyancy is broken" and "two of four pontoons are dry".

⚠ Unmanaged, so a debug draw can walk it as a span — the per-pontoon forces are deliberately not here. Those are Forces' scratch, live for the step that produced them, and copying them into a component would be an array per body per step for a picture nobody is usually looking at.

Fields and properties (6)

  • public int Wet

    How many pontoons touched water on the last step.

  • public int Total

    How many there are in total.

  • public float Submerged

    The mean submerged fraction over every pontoon, 0…1.

  • public float Lift

    The total upward force applied last step, in newtons.

  • public float SurfaceHeight

    Where the surface was over the body's origin, in world units.

  • public readonly bool IsFloating

    Whether any part of it is in water at all.

Used by (10)

  • BuoyancyDebugDrawVixen.Water.Physics
  • BuoyancyDebugDrawTestsVixen.Water.Physics.Tests
  • BuoyancySystemVixen.Water.Physics
  • BuoyancySystemTestsVixen.Water.Physics.Tests
  • ComponentRegistrationVixen.Water.Physics
  • TypeRegistrationVixen.Water.Physics
  • Vixen_Water_Physics_BuoyancyStateSerializerVixen.Water.Physics
  • MaterialIconsVixen.Editor.App
  • SceneWaterComponentTestsVixen.Editor.Assets.Tests
  • WaterSceneRunsTestsVixen.Editor.Assets.Tests