Original Post
I am working on a 3D game in OpenGL on Android using the libGDX framework. I have a sphere drawn at the origin and I am working on getting the camera to orbit the sphere freely on any axis. I would like to control the camera with a virtual joystick that I have being drawn in the bottom left corner. I have started to attack this using spherical coordinates and converting them to cartesian coordinates. My problem is how can I control the spherical coordinates of theta (angle between x axis and ray from the camera position to the origin), and phi (angle from the z axis to the same ray)... I've also noticed that as the camera is orbiting the sphere, after the angles hit 45 degrees the direction changes by itself and starts to loop around the other way (note: I am currently getting movement by just incrementing theta and phi at the same time by 1 degree up to 360 and then back around). Thanks for any help at all on this!