First Person Camera(Sort of)

I’m trying to make an object rotate in the direction the mouse points to like the first person camera can.

So far I have

void Update () {
//Debug.Log(Input.GetAxis(“Mouse X”));

float mX = Input.GetAxis(“Mouse X”);
float mY = Input.GetAxis(“Mouse Y”);

Quaternion b = transform.rotation;

Debug.Log(b.x);
float y = b.y + mY;
float x = b.x + mX;
float z = b.z;

Debug.Log(b.x);

Quaternion n = new Quaternion(x, y, z, b.w);

transform.rotation = n;
}

Can anyone point me in a direction to make it work?

I think if you look at a first person controller, it has by default a MouseLook script. I think you can take that script and attach it to a camera to make it do just that.