But about a year ago, I found an article called Water interaction model for boats in video games. The article told how you can develop a computer model to make an object, like a boat, float in a realistic way by adding the real physics equations. This is how it works: All computer 3D models consists of triangles:
To make an object float you have to figure out which of the triangles are below the water line. If only a part of the triangle is below the water line, then you have to cut the triangle into pieces. It looks like this in Unity:
You can see that the model cuts the hull into two pieces: the yellow one which is the part of the hull that's above the water line, and the red one which is the part of the hull that's below the water line. You can also see that the model has modified the triangles that are only partly submerged by dividing them into new triangles.
When you know which triangles are below the water line, you can add the buoyancy force to make the boat float. But the buoyancy is not the only force acting on a boat. What you need is also the resistance forces. Luckily, the guy who wrote the first article published another article called Water interaction model for boats in video games: Part 2, describing the forces that you should add to make the boat behave more realistically in the water.
The forces you have to add include: viscous water resistance, pressure drag, and slamming force. But that's not enough, you also have to add the fifth force: air resistance, which is acting on the part of the boat that's above the water line. But since you now know which part of the boat is above the water line, then that force is easy to add. When you've added all five forces, the boat should behave in the water like this:
And if you don't want to figure out how to write the code yourself, I've written a tutorial on how to do it in Unity with C# code: Make a realistic boat in Unity. In the tutorial you will also learn how to make an endless ocean with waves.