Okay so I am making a custom swimming system basically replacing roblox’s swim mechanic but using the same terrain water because it looks nice.
How can I detect when a player enters the water? First off I want to be able to detect how deep a player is in the water, e.g if just their legs are in the water or if there head is submerged or if their head is not submerged but their torso is.
Then I want to get the terrains Y size so for my swim mechanic I can let a player swim up to the top of the water but obviously restrict them from going any higher. I was thinking of having a raycast that only detects water and make it 500 studs above the player then raycast down to get the max Y height of the water but I am not sure how to whitelist a raycast to only detect terrain water. And maybe thats not the best way.
P.S I cant detect that a player has entered the water by checking for the swim state as I disabled it to make way for my own custom swimming mechanic.