transform.rotation not correctly rotating object

Hello. I’m currently experiencing an issue with the transform.rotation command. When I attempt to transform my object using this command, which points my object using the right stick on an XBOX 360 controller –

transform.rotation = Quaternion(0,(Mathf.Atan2(Input.GetAxis("FIRE X"),Input.GetAxis("FIRE Y")) * Mathf.Rad2Deg )+90,0,0);

it fails to actually execute the rotation correctly. What actually occurs here is that the object will always correctly point up and down at 0 and 180 degrees, but in anything other than the two the object fails to rotate at all, simply hold rotation at 0 or 180 degrees. Is there another way this command can be parsed in which will give the desired effect?

Thanks in advance.

Sure, you set the components of the quaternion manually! The components shouldn’t be accessed manually since they doesn’t represent angles. Use Quaternion.Euler() to create a rotation of the given euler angles.

For more information see Quaternion