(FPS movement) Need help changing movement direction on button press

I want my character to change movement direction (keep same speed) upon pressing a key when grounded. Preferably change direction to camera angle (if w/a/s/d not pressed) and to directions away from the camera (w/a/s/d pressed)

1st video is an implementation of this in a game called Warsow/Warfork
2nd video is where i’m at