title: Moving gameobject in a smooth circle around the player object
body: <p>I'm using unity 5.1.2 if that makes a difference.</p>
  
  <p>I have a game object shield, that I want to move in a circle around a player. I have it working to a degree, the shield responds well to input but is not animated in that it just teleports to the new position instead of moving around in a circle in a smooth rotation. The game is 2D top down so working in the x/y plane only. Have tried to use lerp and slerp but not getting any joy</p>
  
  <p>Would really appreciate your help to figure this one out!</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>public class ShieldMovement : MonoBehaviour {
  
      public Transform target; //player shield is attaced to
  
      float distance = 0.8f; // distance from player so it doesn't clip
      Vector3 direction = Vector3.up;
  
  
      // Use this for initialization
      void Start () {
  
      }
  
      // Update is called once per frame
      void Update () {
  
          float angle = Mathf.Atan2 (Input.GetAxisRaw("rightH"), Input.GetAxisRaw("rightV"))* Mathf.Rad2Deg;
  
          if(Input.GetAxis("rightH") != 0f || Input.GetAxis("rightV") != 0f)
          {
              direction =  new Vector3(Input.GetAxis("rightH"),Input.GetAxis("rightV"), 0.0f ) ;
          }
  
          Ray ray = new Ray(target.position, direction);
          transform.position = ray.GetPoint(distance);
  
          if(Input.GetAxis("rightH") != 0f || Input.GetAxis("rightV") != 0f)
          {
              transform.rotation = Quaternion.AngleAxis(angle,Vector3.forward*-1);
          }
      }
  }
  </code></pre>