How to calculate correct movement direction relative to rotation. (HELP)

Hello, I’ll try to explain myself as best as possible.
Basically I’m creating a 3D zombie shooter game and I’m currently trying to set up the animations for the legs of my character so that they correlate to the direction hes currently moving in (Forward,Back,Left and Right). The movement is controlled using the Left Joystick, and the Rotation (player aim) is controlled using the Right Joystick.
I’m looking for some sort of equation that will calculate the correct direction so that I can feed it into the animation blend space.
My problem lies in the fact that since the rotation of the player is constantly changing then so do the directions.
I’ve tried using the Calculate Direction node in the animations blueprint but that hasn’t given me any useful results, maybe i’m not using it correctly.

Here’s an image I made to better illustrate what I mean.

I’ve managed to get a function done which kinda works but not always since I use a lot of if statements and it turns into a huge blueprint. I’m sure there has to be a more clever way of solving this issue. Any help would be greatly appreciated.
Here’s a video I recorded of what I mean.

Thanks a lot.

Download the starter animation pack and look at the anim BP in there, it does exactly what you want with a 2D blendspace

Word of warning the blend space itself that epic created is not quite right as the forward/left back/right anims are wrong so those directions look well rubbish. Just ignore that its fine when you create your own blendspace and do the animations correctly