This works really well, but I had one issue. I couldn't move up and down in the water! But I found my solution and maybe I could help someone out. I placed my target object in front of the player but I noticed that as I moved my player's cam around, the target wouldn't move up and down, and the script is designed to move the player where the target is, which is why I wasn't able to go up and down. However, I placed it as a child in my main camera, which made the target move accordingly with the camera, basically meaning that wherever I looked, the target would move at that position. I offset the target on the z axis when I put it as a child of the camera. So make sure your target object is moving up and down when you look up and down or you won't swim in the desired direction!
I could have sworn I mentioned that in the tutorial. If I didn’t then yes please this will only work if it’s a child object of the object that is being moved which in this case is the camera
I have my main cam with different cinamachines for third person , third person combat , third person top down, and fps and every works awesome thanks to you its only the top down view which i cant use with this swimming but youre comment helped me more the struggling a day with chat gpt XD
Kind of. You would need to adjust your third-person controller to move freely without gravity if 'isSwimming' is turned on. That would be the only difference, and unfortunately, it isn't the same as first-person movement version for free moving through 3D space.
Hello. Would this logic still work if it were a 2D side Scroller ? I would like to make some portions of a metroidvania game include some underWater areas. My character does have a Rigidbody2D so i feel like it might work. Thank you for a great tutorial.
Sort of. I think there are tutorials specifically for side scroll swimming though. They probably won’t be as “to the point” as our tutorials are but I would just try different things until you get something that works for your project.
Updated and improved version of the code is now on our Patreon www.patreon.com/JTAGamesInc. It's much better with much cleaner code. Thanks!
The link doesn't work.
For some reason my character can only move forward and back on the Z axis..
it wont allow me to move in the direction that i'm facing :(
did you fix this? i'm haing the same issue
This works really well, but I had one issue. I couldn't move up and down in the water! But I found my solution and maybe I could help someone out.
I placed my target object in front of the player but I noticed that as I moved my player's cam around, the target wouldn't move up and down, and the script is designed to move the player where the target is, which is why I wasn't able to go up and down. However, I placed it as a child in my main camera, which made the target move accordingly with the camera, basically meaning that wherever I looked, the target would move at that position. I offset the target on the z axis when I put it as a child of the camera.
So make sure your target object is moving up and down when you look up and down or you won't swim in the desired direction!
I could have sworn I mentioned that in the tutorial. If I didn’t then yes please this will only work if it’s a child object of the object that is being moved which in this case is the camera
I have my main cam with different cinamachines for third person , third person combat , third person top down, and fps and every works awesome thanks to you its only the top down view which i cant use with this swimming but youre comment helped me more the struggling a day with chat gpt XD
@@reaporofdragon744 no problem dude :)
Hi! I followed the tutorial completely but for some reason I just fall through the water object, is there any way I can fix this? Thanks.
i jump in and i just fall
I get so many errors and i dont know how to fix them. Pls paaste the codes to video description
Our code will eventually be available to our patrons. www.patreon.com/JTAGamesInc
It's going to take some time to back catalog.
can i use this to work in a third person controller? i have my own third person movements i just want a swimming system
Kind of. You would need to adjust your third-person controller to move freely without gravity if 'isSwimming' is turned on. That would be the only difference, and unfortunately, it isn't the same as first-person movement version for free moving through 3D space.
Hello.
Would this logic still work if it were a 2D side Scroller ? I would like to make some portions of a metroidvania game include some underWater areas. My character does have a Rigidbody2D so i feel like it might work. Thank you for a great tutorial.
Sort of. I think there are tutorials specifically for side scroll swimming though. They probably won’t be as “to the point” as our tutorials are but I would just try different things until you get something that works for your project.
How do you fix the FirstPersonController from jumping on the Water?
Is the players layer set to “EyeLevel”
@@JTAGames The First Person Controllers layer is set to Default and the Tag is on Player
@@cupded you probably didnt set the water collider to isTrigger