How to magnetize the player to a narrow platform?

Hello, I’m looking for a few weeks for a way to “snap” a character when walking on a narrow platform. The 3rd person character arrives on a narrow platform and has to step on it, but depending on where the camera is and how the joystick is used by the player, the character tends to fall too easily, so I would like to cheat a bit and help the character stay on the platform and move in the right direction as long as the player doesn’t force the joystick too much. Do you think of a method to do it?