Vixen
c7401864
csharp
public static class Buoyancy

Pontoons floating on the one surface everything else reads.

Read the guide page for this →

Remarks

[35 § D10](../../docs/plan/35-water.md#d10-buoyancy-is-pontoons-over-jolt-evaluated-at-the-fixed-steps-water-time). Per fixed step, per pontoon: ask the evaluator where the surface is, work out how much of the sphere is under it, and produce an upward force at the pontoon's world position, a drag opposing its relative velocity, and a pull towards the flow.

⚠ It reads the simulation's water time and never a frame time. A buoyancy force computed from an interpolated render-time surface is a force that changes when the frame rate does, and in a networked game that is a client and a server disagreeing about where a boat is. That is [16](../../docs/plan/16-networking.md)'s determinism requirement applied to a force, and it is why the evaluator's explicit waterTime is not a stylistic choice.

⚠ Jolt has a buoyancy impulse of its own and it is deliberately not used. It takes a plane, which is exactly the approximation a wave surface is not — and using it would put a second definition of the water surface inside the physics engine, where the seam test cannot reach it.

Zero-allocation and pure, because the answer to "how many floating crates" should be "as many as you like" — and because a rollback re-simulating six ticks needs this to be a function of its arguments and nothing else.

Fields and properties (1)

  • public const float Density

    Fresh water, in kilograms per cubic metre.

Methods (4)

Used by (4)

  • BuoyancyDebugDrawVixen.Water.Physics
  • BuoyancySystemVixen.Water.Physics
  • BuoyancySystemTestsVixen.Water.Physics.Tests
  • BuoyancyTestsVixen.Water.Tests