Vaulting system

Is there a way to check if the player is close enough to a ledge, to then push them over? Maybe using raycast if possible?
Also, is there a way to get rid of player movement, what I mean is when you press a button (for example a button to crouch when running) it will boost you forward, you can’t still look around but not move in different directions yet.