I currently have an earth and a moon. What I'm trying to achieve is to have the moon physically rotate around the earth horizontally along the equator along a circular path.
moonAngle = (moonAngle + 0.5f) % 360f;
xPath = (float) Math.sin(Math.toRadians(moonAngle)) * distance;
yPath = (float) Math.cos(Math.toRadians(moonAngle)) * distance;
gl.glTranslatef(xPath, yPath, -30f);
The above works fine, except the moon is rotating around the earth vertically around the Prime Meridian like a wall clock. How do I adjust the angle of rotation? I've tried modifying the glTranslatef, but with no success.
glTranslatefcall? – Sam Hocevar Jan 13 at 23:42gl.glTranslatef(xPath, 0f, yPath-30f);. But most of all you want to remove hardcoded values and use named variables for the Earth position. – Sam Hocevar Jan 14 at 0:13