- Home /
Orthographic Camera rotation on world y-axis but also rotates z-axis slightly?
Hi, I'm trying to create and Orthographic camera for a 3D isometric perspective/styled game me and my friends are making. I can not figure out why when I attempt to rotate the camera along the y (global up axis for the scene) the z axis also changes to some seemingly random and noticeable value. I somewhat doubt what I'm seeing is floating point error because the numbers vary from the 0 they are supposed to be by as much as a whole 9 degrees with values changing randomly as I press the key assigned to rotate the camera.
I have my rotation angle degrees set to increments of 15 degrees. Below is the code I have been using and am attempting to fix:
if (Input.GetKeyDown(KeyCode.Q))
{
transform.Rotate(Vector3.up * cameraRotationAngle, Space.World);
}
if (Input.GetKeyDown(KeyCode.E))
{
transform.Rotate(-Vector3.up * cameraRotationAngle, Space.World);
}
I have tried numerous variations on the same thing including trying to set transform.eulerAngles. This produced similiar results. I'm at a loss as to what I'm doing wrong here and how to fix this. Any help would be greatly appreciated.