I have a script that rotates an object as the cursor moves, it's set to rotate on the X and Z axis. However rotating on both of them at an angle simultaneously and then rotating back at a different angle (the effect of making a circle motion repeatedly with the cursor) causes it to have an end result of only rotated on the Y axis with the X and Z being what they were originally.
How can I have it not rotate at all on the Y axis even though a script is directing it to rotate along the X and Z axis?
Here's the script that handles the rotation:
var xDeg = 0;
var yDeg = 0;
var speed = 10.0;
function Update () {
xDeg = -Input.GetAxis("Mouse X") * speed;
yDeg = Input.GetAxis("Mouse Y") * speed;
transform.Rotate(yDeg, 0, xDeg);
}