# Rotating an object around a rotating object

Im trying to build a model for the solar system in OpenGl, and I got the planets to move around the sun, but can't get the satellites to move around their planet. I can't share my code since this an university assignment, but my current 'orbiting' angle is 2 * glm::radians(180.0f) * (time / body.orbitPeriod) , where time is a constant that is given to us, body is the planet and .orbitPeriod is how long it takes for a planet to complete an orbit.

angle = 360 * ((time %% satellite.orbitPeriod) / satellite.orbitPeriod)