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?