I am trying to make a game which takes place mostly on an ocean. I’m not going into very high detail so I didn’t make the water physically realistic. I am trying to rotate the model of my boat around an axis defined by a “Wave Director” transform. What is happening though is that no matter which way my ship points it always rotates the same. The code I am using is shown below.
ShipBody.Rotate(WaveDirector.right * waveStrength * (1 - Mathf.PingPong(Time.time * 2, 2)));
The code is supposed to “Ping Pong” rotate the ship about 90 degrees of the direction of the waves as defined by the “WaveDirectors” Forward direction to simulate the bobbing you might get from actual waves. The code is currently just place into the update function and I expected that to cause an updated direction, but I expect the problem comes from the fact that I need to compare the boats forward direction to the wave directors right, but dont know how to do that.
Any help would be deeply appreciated.