How to code 2D top down shooter character rotation with arrow keys?

Basically I want character direction independent of movement. I already have movement scripted, but I am unsure how to get the character to rotate. Here was my attempt. The character snaps to different rotations but I want it to be smooth.

Currently I have WASD as move and Arrow Keys as rotation. These assignments in my code were to make it so up and down turned 180 and left and right turned 90.


            float deltaH = Input.GetAxis("P1_Rotate_Horizontal") * 180;
            float deltaV = Input.GetAxis("P1_Rotate_Vertical") * 90;
            float newZRot = deltaH + deltaV;
            transform.rotation = Quaternion.Euler(0, 0, newZRot);

Down should be down, right should be right, down + right should be a diagonal. I want it to lerp between rotations.

You could use Unity’s new input system. You simply install the package, create an Input Actions asset, create an action map for your player and create two new actions, one for moving and another for rotating. Then, configure the actions to fit what you need. Make sure to check this page if you decide to use it: New Input System Guide.