Custom swimming system - Floating to surface

Hello
I’m currently creating a custom swimming system. I’m using the solution described in this post: How to create terrain water behavior, without terrain water - #13 by Aorda.

However, now I want to add a force that makes the player float to the surface of the water (like SmoothTerrain water). I’m currently trying to use a BodyPosition for this, with the position set to the water’s surface.

This is not really working though. The BodyPosition interferes with the BodyVelocity, and if it’s MaxForce is set to high, the player won’t be able to swim. If it’s MaxForce is set to low, the player won’t float to the surface.

Is there another way to make the player float to the surface just like with SmoothTerrain?

Thanks.

I have already searched for this on the forum.

4 Likes

Maybe it would be possible to add a body force or velocity when there is no user inputs so you can swim freely but when you stop, the force activates and pushes you.

1 Like

Thanks

The way I have it now is to always apply the BodyPosition. I will try what you said and see if that helps.