I am trying to write some code to rotate and object around the y-axis. Every time I run the code, the
cubeTransform.localRotation.eulerAngles.y, eventually ends up at 0 and resets the transform to 0 and I cannot move with the mouse.The code is running in the update function. Help!
float newRotation = Input.GetAxis(“MouseX”) * cubeTransform.localRotation.eulerAngles.y * rotationSpeed * Time.deltaTime;
cubeTransform.localRotation = Quaternion.Euler(0, newRotation, 0);
FYI…I have a public reference to the Transform of the object called “cubeTransform”. Also, the code seems to work with cubeTransform.Rotate(0, newRotation, 0) until I get to zero in the y transform rotation. Hmm…