Buoyancy

How it works
The buoyancy system calculates the entire FFT grid on the CPU, mirroring the GPU implementation. For performance reasons, these calculations are triggered every BuoyancyUpdateTickRate (0.2 seconds by default). This should be sufficient for most use cases, such as vessel buoyancy and character swimming. However, if you need updates to occur more frequently, this parameter is exposed in BP_PlanetaryOcean.
These CPU calculations run in parallel using the ISPC task system and do not block the game thread. The ready-to-use data can then be sampled by the buoyancy component (for vessels) or the swimming component (for characters) to apply forces. Reading these values is virtually free, because the computed data covers every possible location across all wave cascades. Since the cascades are tiled indefinitely, data is available for the entire ocean sphere.
PlanetaryBuoyancy component must be attached to an Actor to enable floating. This component reads the depth below (or above) water for a specified array of BuoyancyPoints. Using this data, it applies forces to the BuoyancyPoints. It also includes built-in gravity.
Setting up buoyancy
To set up buoyancy on your Actor, follow these steps:
Add
PlanetaryBuoyancycomponent to your Actor blueprint.In the component settings fill the
Buoyancy Pointsarray. Vector locations it is asking for are in local space (relative to the root). It is recommended to have more than 4 Buoyancy Points for smoother buoyancy simulation. System will sample the water height and apply buoyancy forces at these locations.

Make the Static Mesh Component you want to float as root component. Static Mesh can have any other components attached to it (meshes, cameras, particles etc.)
If your Actor is added to the level, you can navigate to the Primary Ocean category in the component settings and set the existing in the level
BP_PlanetaryOceanto the ocean you'd like this Actor to float on. If not set, the Buoyancy Component will assign the first found in the level object of classAPlanetaryOceanon BeginPlay and use it.

Now you can press Play and tweak the buoyancy settings.
Last updated