Do not sink or float in water?

I need to be able to allow a character to neither sink nor float in terrain water.

I have seen several posts about this, but none of the solutions seem to work.

Some suggest, setting custom physics on all base parts to 1, when player.Character.Added fires, others suggest when player.CharacterAppearanceLoaded fires

Then some suggest changing the parts to 1 but doing it on the client, under render stepped.

Others suggest, that 1 is not the correct value for density but rather .92 or other altered numbers.

None of this works consistently between avatars. If I set the proper value for one avatar, then I log in with a different avatar, the numbers don’t work.

So there must be some sort of formula, I would hope, that could calculate what density I need to set the parts to, dependent upon avatar, to achieve neither sinking or floating, but to just remain stable.

Thanks.

If all of your terrain is made of water, you can assign a CollisionGroup to it to prevent all collisions.

Otherwise, try Humanoid:SetStateEnabled, and disable the swimming state. Then, set the CustomPhysicalProperties.Density of the HumanoidRootPart to something like 5.

1 Like

I don’t want to sink, that would just make me sink to the bottom.
I want to ‘hover’ remain constant in place, not float nor sink.

But thanks for taking the time to reply.

Oh. In that case, set every Density property of every BasePart in the character to 1.

As I said the the original post, that doesn’t work.

Are you setting every child Part of the Avatar to Density 1 including the accessories?
Water Density is 1 so if every single Part in the Avatar is 1 (I’m not sure about Massless items though) then the Avatar should stay at the same level.

Yes, but to test, I even tried it with a character that has ‘LoadCharacterDescription’ turned off, so it just loads a blank character.

Still it would not ‘hover’ with all GetDescendants() set to a density of 1

There must be some way to know what is required for this.

When you are testing click on your avatar in the Explorer window and have a look at the Density of the Parts there.
I think I heard that if you just change a Humanoid Property it will just change back in the next heartbeat. Check the actual player part properties while playing to see if the Density is 1 or something different.

Well, I have tried it several ways, I tried it where the server sets it when your character loads, and when in studio, if I click in explorer, it shows it to stay set.

But I heard the same thing you did, so I also added a client script where each frame I set it all again to a density of 1, still I sink

I almost wonder, if, considering heads and body parts are meshpart, if that is making a difference?

Try disabling animations, placing a blank LocalScript in StarterCharacterScripts named Animate.

Okay, sorry for the duplicate post but I just tested this:
robloxapp-20220914-1727590.wmv (1.4 MB)

I don’t know what the problem is with your character. Make sure the tools are all massless.

probably because you are using R6, I need this to work with R15
WaterFail.rbxl (39.4 KB)

Try this script, works for most if not all avatars, since it doesn’t depend on avatar but rather corrects values according to the rate at which the avatar sinks/raises!