Subnautica Type swimming
So I want to make a swimming system kinda like the one in subnautica. For example where I look I want my character to swim to when I press W and when I'm not pressing anything I want to float in place. I have already done my research to figure this out on my own but all it has done for me is giving me a headache. please help. Oh and put it in c# please
Answer by Pepsidog · Jan 31, 2018 at 09:20 PM
Use add force in a forward direction.
https://docs.unity3d.com/ScriptReference/Rigidbody.AddForce.html
https://docs.unity3d.com/ScriptReference/Transform-forward.html
um can you elaborate. I tried doing so but it doesn't work
Answer by GeekyRaptor · Feb 02, 2019 at 06:25 PM
I did something similar and it worked for me, try redhen's tutorial on YouTube about first person character movement scripting, he uses a script that uses force and adds friction to the player object so it doesn't just keep sliding the direction you move, this causes the object or player to slow down once it isn't being made to move. I used this script and adapted it to third person, as for the floating in water, maybe a super low amount of gravity? I managed to create a sphere that flew the direction the mouse was pointing and it would fly when the 'W' key is pressed down.
A link to the tutorial I followed: https://youtu.be/P8HTb9lH$$anonymous$$LU