Ship motions caused by waves

I need to write a script that make the ship roll, pitch and yaw from side to side as it is floating in a slightly wavy ocean. I already wrote the movement and rotation of the ship but it looks so stable as it is moving or standing over a solid flat surface…

I don’t know where should I start? Should I write a sine based algorithm or are there any better way for such kind of things?

Some quick research brought me to a collaboration page where they are/were working on a shader for waves. One entry in there has a cool function for figuring out the height of a wave at a certain point. This may be a good starting point for you.

http://forum.unity3d.com/threads/16540-Wanted-Ocean-shade
http://forum.unity3d.com/threads/16540-Wanted-Ocean-shader?p=157054&viewfull=1#post157054

I’d start with a sine solution and see how far it gets you. Much simpler the trying to get Tessendorf working just to get your boat to roll!

Thank you for your answers. I managed to implement the ocean system. Is it belongs to Tessendorf? and who is him? (He looks like he is the computer graphics advisor of the queen :slight_smile: ) Anyway, it is working great but the whole system is consuming too much processing power, which makes it not suitable for an RTS game.

At least, I have a very good benchmark now.

I think I will start with a sine solution and try to achieve a similar looking effect.