Using a Buoyancy component, I have made my character able to enter swimming mode and exit into walking mode. I’m using the UE water plugin for the water bodies. This part works perfect.
The problem is, when I reach the surface of the water, the character keeps switching between falling/swimming mode and causes a lot of jittering.
How could I make the character stop doing this and just stay level with the waterline?
Things I Have Tried:
In the water body, I tried adjusting the “Collision Height Offset” this did not appear to have any effect.
Disabling jumping while in water and setting OutofWater Z to 0, 100 and even -1000
Hey there @Z3R0K0! Depending on how you want the player’s interaction with water to go, swapping to the Falling state is somewhat expected. I would personally try to make a “Cooldown” between certain state transfers, so for maybe half a second after leaving the water the state doesn’t change, the state can attempt a change. This should be instantly overridden if the character touches the ground.
My apologies, I had left the office after my previous response. Looks good, a surface swimming state is one way to solve it. I’d recommend testing for edge cases like high speed ejection from the water as well.
It works quite well, but I have started working on something else so I’m not going to go any further for now. Its probably easier and less time consuming to buy a swimming system from fab.
But yes, it did fix the issue I was having. I posted the blueprints here in case someone wants this information in the future.