title: Moving camera around an object in Unity
body: <p>Previous posts here did not seem to address my problem.</p>
  
  <p>I'm trying to get my camera to move around a specific point called "target". Target is an empty gameobject set at the center of my game. The idea is that the camera would not move any closer to or farther from target and would simply rotate around the target as though it were moving around an invisible sphere. The camera should always point at target. <code>transform.LookAt(target)</code> does just fine keeping the camera trained on the target, but I cant get the movement correct. Whether I'm moving along the horizontal or vertical axes, it always spirals directly into the target rather than just moving around it. Any ideas?</p>
  
  <pre><code>public class CameraController : MonoBehaviour {
  
  public float speed;
  public Transform target;
  
  void Update () {
      transform.LookAt(target);
  
      if(Input.GetAxis("Vertical") != 0)
      {
          transform.Translate(transform.up * Input.GetAxis("Vertical") * Time.deltaTime * speed); //.up = positive y
      }
  
      if(Input.GetAxis("Horizontal") != 0)
      {
          transform.Translate(transform.right * Input.GetAxis("Horizontal") * Time.deltaTime * speed); //.right = positive x
      }
  }
  }
  </code></pre>