Expression (driver) that helps me to translate movement to degrees?

Hi. I would like to simulate a mesh affected by the ocean. This mesh is attached to an arm that rotates around an axis. When the waves affect the mesh the arm will consequently rotate.
Here is a simple sketch I made:

I am kind of close to the solution. I am using drivers. I have two empties. One placed in the 0 points, when the ocean has no waves the arm needs to be 5 degrees. Then I shrink-wrapped a second empty to the ocean. When the ocean is moving the empty will follow. The driver I am using takes the distances between the 0 empty and the moving one and translates it to the rotational axis of the arm.

driverdata

I am multiplying the var by 0.009 to get a less extreme rotation angle.
It is kind of working. But I did this without understanding the math behind.
That’s the reason I am asking here:

Is this the right way to do it? Am I translating the distance between both empties to an angle? It certainly rotates cause the driver is placed in the rotational axis in the properties of my mesh. But not sure that it’s following correctly the tide. It seems it rotates, but kind of randomly. Few questions:

  1. Is it possible to translate the distance between empties to degrees?
  2. If the answer to question 1 is yes. Can I make the values when the empty following the tide is above the still empty be positive and when is below negative?
  3. The arm already has an angle how can I add the values to that angle, I do not want to replace them. That’s why there is an empty not moving when the arm should be 5 degrees. My 0 tide = 5 degrees in the arm.

NB.
I understand that the mesh moving should also move also on the other axis besides Z. If not the arm will not be able to rotate in a circular way. But I want to use the z value cause that’s the one I can find. So the simulation will not be 100% accurate. In order to have the right rotation, I should also have the information of the mesh moving not only in z but in the other axis too.

Hope this is possible to do. I feel I am just pressing buttons :slight_smile: