title: 3d movement around a sphere
body: <p>I'm working in 3d for the first time in a long time. Basically I'm rotating a sphere and projecting x y z cords to place things on the surface based on the spheres X and Y rotation.</p>
  
  <p>Heres the code im using:</p>
  
  <pre><code>    #define piover180 0.01745329252f
  
      GLfloat cosy = cos(yrot * piover180);
  
      island[i].x = rad * sin(xrot * piover180)* cosy;
      island[i].y = rad * sin(yrot * piover180);
      island[i].z = rad * cos(xrot * piover180) * cosy;
  </code></pre>
  
  <p>Problem is the Xrot positioning works fine but the Yrot placement always draw the objects into the north and south pole so they all cross at the top, which isn't correct for rotating. I need a way to solve this. Here's a picture to help explain:</p>
  
  <p><img src="https://i.stack.imgur.com/gTSjh.jpg" alt="Screenshot"></p>
  
  <p>Any help would be greatly appreciated, let me know if you need any more information?</p>