2D water line without physics

Hi everyone,

There are some pretty awesome water assets in the store. But for our current project, we are mostly using raycasting and not physics which these water assets need. Could anyone point me in the right direction on how to make a dynamic water line when a non-physics (character is a kinematic rigidbody) game object enters the trigger area?

The ‘physics’ of the water is already simulated by a script(i.e how the character behaves within it). So literally just need the ‘waves’ as it were.

Well, in that case you’d have to do all the physics calculations yourself.

If you only want waves, this isn’t too hard: simulate the water surface as a bunch of points connected by springs, and when the character enters the water, displace some of them (and then let them go).

Now, if you want to also include splashes, it gets very very hard very fast. I’ve worked on that before, and you very quickly get into difficulties as deep as your water! Doable, but plan to dedicate a few weeks/months of serious work on it.

Maybe these links are what you are looking for:
Creating Dynamic 2D Water Effects in Unity
Make a Splash With Dynamic 2D Water Effects

2 Likes

Those are great resources. I especially like the look of the splashes in the second one. They’re not totally realistic, but the visual effect would be good enough for many purposes.

These are great! Thanks for the help guys! Going for more stylistic over realism so hopefully can get it to work.

If you are talking about buoyancy, just set a Y value that is the water line and lerp force or movement so the object travels back to the Y line over time. Works well for moving height too.

This is how I did it on Bath Time (iBath).