Is it possible to make a Lean animation in Unreal Engine? (Like in the old games)

I would like to know if it’s possible to do a lean animation (lean left, and lean right) in Unreal Engine?

Here you can see an example:

Here is a screenshot leaning right:

Can you see the leaning left, and leaning right?
It’s done with Z and C. Lean left is pressing Z, and lean right is pressing C on the keyboard.
You can lean at the same time that you run left pressing A+Z, and lean while running right pressing D+C (many old games have this).
And you can lean left and right, while running forward pressing W.
And you can lean left or right, while running forward in diagonal pressing W+A+Z (running left, forward, leaning left) or W+D+C (running right, forward, leaning right).
Even you can lean in the opposite direction you are running, like W+A+C (running forward, to the left and leaning right), or W+D+Z (running forward, to the right and leaning to the left).

AWSD, is common just like in Counter Strike or any game. A is left, W is forward, S is backwards, D is right.
Basically, I want to assign the keyboard keys Z to lean left, and C to lean right (in a first person shooter), with the animation of the character.

Is this possible in Unreal Engine?

yes it can be done in Unreal Engine, you just rotate the camera slightly when you press those keys.

Thanks, the reply is very much appreciated.

So we would just rotate the camera when the keys are pressed, and the upper-part of the character’s body, moves automatically or would we have to do anything else?

Sorry for the noobiness, but I’m trying to figure if this can be done in the Unreal Engine.

If you parent the skeletal mesh of the arms to the camera, yeah, it’ll rotate with it. Just drag the mesh in the hierarchy to the camera and it’ll parent it.

Don’t You want the camera to only lean when you are pressing down on the keys?. If you parent the game camera to the mesh on the arm, it could have unpredictable results.

Yes, only lean when we are pressing down the keys. So no mesh parenting. Rotating the camera would have better results if I understand from you. So all I would have to do is parent the camera position to the Z and C keys, is this ok?