Hello, i have this coed that rotates an object based on mouse position
void LookAtMouse()
{
var dir = Input.mousePosition - Camera.main.WorldToScreenPoint(transform.position);
var angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
}
But i need my object’s rotation to be affected only by the x position of the mouse.
Can someone please help me with this one?