How to rotate legs in place in a first person shooter game

Hello, I would like the player’s legs to rotate towards where the player is looking when the camera rotates to far from where the legs is pointed at (think of the halo games for example).

Edit: The legs of the player and the upper body are a separate mesh.

i would say you would need to on camera moving get the difference in rotation of the camera and the leg mesh. then if the angle is 45degrees or greater in the Z axis set the rotation of the legs to the rotation of the camera.

below if a very basic example which is incomplete and not very elegent but is shows some of the concepts. this example is done with the third person style so some things will be different for sure.

If you want a a continuous update in rotation of feel where the character turns in place immediately as the player turns, you could use separate states with turn in place animations for respective directions. You could then check for horizontal input when the player is idle i.e not moving. If the input is to the right then change to the right side turn in place otherwise, the left. Exit the state or just play idle if there is not turn input. Keep your blendspace for walk/ run in a separate state. That’s how I did it