How to calculate input direction based on actor rotation and controller rotation?

guys i wanna calculate the direction player should move depending on where the controller is looking and where the character is facing.

so if the camera is looking from left side of the player and the player presses D the player should turn 180 degrees, or if they presses A the player should just move forward,
and if the controller and the player are facing the same way and player presses W the player should just move forward.

how can I calculate this?

basically i wanna recreate the orient rotation to movement system except that I wanna do it with root motion animations so I wanna know which of turn in place animations to play depending on the input. is this approach even gonna work? i feel like its not…

This will do what you asked in your first post…

Perhaps share what you have done and I’m sure others could be of a lot more help.

Basically I’m just trying to setup an animation blueprint using root motion animations. Like the gta or rdr2 movement style. But playing turn in place animations is giving me hard time.

This is supported natively in UE. Look at the third person character package that comes included with UE4 and look at the Movement Component.

Sure. do u know how i can use the movement component to drive root motion animations?

Technically, root motion animation drives the Controller. Most animation calculations are handled in the Animation Blueprint.