- Home /
RigidBody diving into water
Hey there, i'm working on swimming, so far everything is ok.
my problem is when i jump into water, the character goes right to the bottom "ground" surface. tried to set rigidbody velocity.y to zero it's pretty much working exept i keep a bit a speed and keep going down, also i can't swim up till i hit the ground.
my controller is a Rigidbody Custom made and like i said everything work great in swimming state as long as i don't enter water with a jump.
well if there is anyone with an idea, i would gladly take it. thanks to those who will take the time to respond. and also Apologies to native english speaker for my bad english.
,Hey there, i'm working on a swimming state, everything look fine exept if i jump into water the character goes right to the bottom of the sea. can't figure out how to make that the jump stop at the water surface. i already tried to set a second layer of collider to stop the fall but it's not that great, i also tried to set Rigidbody velocity.y to zero when colliding with water surface the character still goes to the bottom till i can swim up again.
Working with my own RigidBody controller.
feels free to give some tips. thanks.
Answer by unity_arTtQxQI74howA · Jul 10, 2020 at 06:24 AM
fixed my own problem i post here a bit of the code i used to fix it.
basically the gravity was the issue and also using rigidbody.velocity was messing around the rigidbody so i took the grounded movement method , made a swimming method and copy paste the code in it with some tweeking and turning off the gravity it's now working fine.
i'm sorry that some of the comment are written down in french since it's my native language and i do comment fast, so it's a bit of both.
again sorry for my bad english, and hope this can help some people with swimming motion.
Any chance you could e-mail me the code? my e-mail: geekyraptorstudios@gmail.com
Your answer
![](https://koobas.hobune.stream/wayback/20220613002850im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 5, script for a character to be able to swim in water 1 Answer
swimming script required 2 Answers
Various Script Problems. 0 Answers
How do I make my FPS Character swim when in contact with water? 2 Answers
How to make a collision trigger thing? 2 Answers