title: How do I create an orbit in libgdx?
body: <p>I'm making a space game, and I'd like to make a small drone ship orbit my bigger player ship. I'm not entirely sure how to make it orbit in a perfect circle. So far I can make it move in a diamond shape, but my attempts to correct for the circle shape have ended in failure.</p>
  
  <p>Basically, I'm doing something like this:</p>
  
  <pre><code>float centerX = ship.getX() + (ship.getWidth() / 2);
  float centerY = ship.getY() + (ship.getHeight() / 2);
  float droneX = drone.getX();
  float droneY = drone.getY();
  float radius = drone.getRadius();
  float xDiff = Math.abs(droneX - centerX);
  float yDiff = Math.abs(droneY - centerY);
  float moveByX = Math.abs(radius / (xDiff == 0 ? 1 : xDiff) / smoother);
  float moveByY = Math.abs(radius / (yDiff == 0 ? 1 : yDiff) / smoother);
  </code></pre>
  
  <p>And then I move the drone by the moveByX and moveByY values. It works fine in a diamond shape, as I mentioned, but how can I improve this to calculate the correct circular pattern?</p>