Rotation Player with hit.normal + mouse Input

Hello Everyone,
I’m making a simple controller to move my FPS player.

I’m able to rotate the player on the Y axis using the Mouse

float yRot =  Input.GetAxisRaw("Mouse X");

Vector3 _rotation = new Vector3 (0f,yRot,0f) * lookSensitivy;

unitBody.MoveRotation (unitBody.rotation * Quaternion.Euler(_rotation));

And I’m able to Rotate with the normal of Ground

RaycastHit hit;

if (Physics.Raycast (transform.position, Vector3.down, out hit, 10)) {
		transform.rotation = Quaternion.FromToRotation (transform.up, hit.normal) *transform.rotation;

But how can I merge both to use hit.normal for my X, The mouse input for the Y and Set the Z to Zero

Thank you.

if this can be done overtime would be awesome.


Quaternion _dirtNor = Quaternion.FromToRotation (unitBody.transform.up, hit.normal) * unitBody.transform.rotation ;

_dirtNor.z = unitBody.transform.rotation.z;
unitBody.transform.rotation = Quaternion.RotateTowards (unitBody.transform.rotation, _dirtNor, Time.deltaTime * rotationSpeed);

unitBody.MoveRotation (unitBody.rotation * Quaternion.Euler(rotation));