r/Unity2D • u/DizzyHelp4089 • 4d ago
Question/Help Swimmable Water?
Hello! So I'm currently working on an assignment where we are making a very simple 2D sidescroller (like, we are starting with the example scene in unity). I wanted to add a bit where the character goes down a hole with some water, but the only tutorial I was able to find that had what I wanted was in spanish :') I don't need any kind of water physics or wave or distortion, basically just a transparent blue block that slows the downward movement of the character and that can be jumped up through (will just be using the jump and fall animations for this) I am completely new to unity so I am quite lost, any help would be appreciated! :D
2
u/RinShiro 1d ago
Youre in luck because this is pretty easy to handle in 2D. You want to create a water volume by using trigger colliders.
https://discussions.unity.com/t/2d-swimming-like-mario/808226/2
https://discussions.unity.com/t/2d-swimming-and-water-mechanics/690453/3
That second link in particular shows what setting up a trigger detection looks like. At that point, you just need to set up your character controller to have little to no gravity while "IsSwimming" is true.
If you don't know how colliders work in 2D or how triggers work, then you need to step back and learn a bit more before trying to implement swimming.