I'm moving around a satellite around another object in 3D space by adjusting two rotational angles - rotation about the X and Y axes of the tracked object. How do I calculate the objects final position given those angles and a radius?
This works fine for just the y-axis rotation:
position.x = otherObject.position.x + Math.cos(yRotation) * radius;
position.y = otherObject.position.y;
position.z = otherObject.position.z + Math.sin(yRotation) * radius;
But as soon as I try and incorporate the x-axis rotation, things get weird.