I need my 1st person character to float on water

So what I mean in short is when the player comes into contact with water they can press up to float on the water and stay up if they are holding space. I dont need a swimming animation just some help for a basic floating mechanic. and if willing to help its C#.

Sorta depends if you’re in 2D or 3D, or first person or third person.

Generally, if the water is flat and has a collider, just raycast to it and use the intersecting point as your new camera position, or as the player’s location.

If the water is animated you might have to separately run an animated set of colliders, or do some kind of trickery to figure out what the height of the water is at a given point. You could also just generically “bob” the player up and down with a sine wave (Mathf.Sin) above and below the contact point of the water.

Thanks for the reply. I will try that out.