- Home /
 
Rotating camera, but it slows down after ~30 degrees?
So I am rotating my camera, using asdw to rotate it left/right and up/down, and I have a script, and after the camera rotates about 30 degrees in any direction, it's rotation starts slowing down into a more "jagged" and slower movement. I have rotationSpeed set to 150 but it doesn't fix the problem. I am looking at a low poly box in .3ds format so I don't think I'm dealing with performance issues. Please find what is wrong with my code. I can rotate it back to 0,0,0 and it moves quickly within bounds, but slows down after going 30 degrees in any direction.
UPDATE: I figured out that if I press asdw for more than a second, it starts slowing down, but I can press asdw again and it will go again and slow down. But I'd prefer for it to not slow down at all.
 using UnityEngine;
 using System.Collections;
 
 public class MoveCamera : MonoBehaviour {
     public float rotationSpeed;
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
         float xAxisValue = Input.GetAxis("Horizontal");
         float zAxisValue = Input.GetAxis("Vertical");
         float xRotation = Input.GetAxis("ZROT");
         float yRotation = Input.GetAxis("XROT");
 
 
 
         Vector3 translateStuff = new Vector3 (xAxisValue, 0.0f, zAxisValue);
         Vector3 rotationStuff = new Vector3 (xRotation, yRotation, 0.0f);
 
         if(Camera.current != null)
         {
             Camera.current.transform.Translate(translateStuff);
             print(xRotation);
             Camera.current.transform.Rotate(rotationStuff,rotationSpeed*Time.deltaTime);
             //Camera.current.transform.Rotate(new Vector3(xRotation, )); 50*Time.deltaTime
             //Camera.current.transform.Rotate(new Vector3(xRotation, ));
         }
     }
 }
 
 
              Your answer