How do I get the characters to swim on the water

I want my character to swim on the water in the game.But it always seems to be affected by gravity.I have cancelled gravity and cut it for swimming.But it doesn’t work,The characters will still sink into the bottom of the water. Here’s my code:

pe_player_dynamics dynamics;

EBUS_EVENT_ID(m_EntityId, LmbrCentral::CryPhysicsComponentRequestBus, GetPhysicsParameters, dynamics);

if (bInWater) { dynamics.bSwimming = true; dynamics.gravity.Set(0, 0, 0); }

else { dynamics.bSwimming = false; dynamics.gravity.Set(0,0,-9.8); }

EBUS_EVENT_ID(m_EntityId, LmbrCentral::CryPhysicsComponentRequestBus, SetPhysicsParameters, dynamics);

Do I need additional additional settings? Why do I still receive gravity?

@Binky_LMBR @Eladdv@Derander_LY@kgwgk