Weird behaviour with custom water physics

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jefvaia

Hello all.

I had an idea in mind some time ago about making the game rocket league in Godot but then on water. I recently picked up that idea and started working it out.
I found some videos explaining how to program simple boat physics in Unity and I changed the code in that video to work in Godot.
Now, I have a cube which is floating on a mesh (and the mesh looks like water with little waves). I also coded some controls to move the boat around and rotate it just like you could in rocket league.

The problem I’m having is whenever i rotate the boat around an axis other than the y axis, it will rotate back to the position it started. My best guess is that it has to do with the order the scripts are run at (I have 4 Position3D nodes with a floating script which calculate how much force up the boat needs to get from their position according to the water.)

Here is the project: Google Drive Link

I hope anyone here could figure it out for me.