Buoyancy script problem

Hi everyone,

I’m having a little problem with a buoyancy script for flat water, I’m working on. I do it by iterating through the triangles, checking if a triangle’s center is underwater, then cancluate the volume of the water ousted by that triangle and then applying the force according to archimedes’s principle at the center of each triangle.

The thing is, it works good on primitives and/or homogeneous meshes that have the same size for each triangle, like spheres, but with meshes that have a high poly-count and are inhomogeneous the forces applied seem to add massive torque and the object is literally being launched out of the water.

Any thoughts on why this behaviour occurs?

Unity has a tutorial about this topic, i suggest checking that out, because in my opinion its really useful

That’s not really how bouyancy works. Not unless you are working in 2D.

By examining each triangle you are iterating over the surface area. To get proper bouyancy behaviour you need to split an object up into volumes and iterate across the volumes.

Note that an irregular shaped object will create torque if the centre of bouyancy is not aligned with the centre of mass.

It also can help to apply a drag force to volumes that are under water. This makes things feel a little more realistic, and reduces general bounciness.