Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a 3D model loaded (a planet) and I have a camera that I want to allow the user to move freely around it. I have no problem getting the camera to orbit the planet around either the x or y axis. My problem is when I try to move the camera on a different axis I have no idea how to go about doing it. I am using OpenGL on Android with the libGDX library. I want the camera to orbit the planet in the direction that the user swipes their finger on the screen.

share|improve this question
up vote 7 down vote accepted

You basically want the camera to walk around on a sphere. And you want the camera to look at the center of the planet while doing it.

Or rotate the camera around it's target. Or implement an arcball camera.

share|improve this answer
Thanks for all of the links. I think I should be able to make something work based off these. – Alex_Hyzer_Kenoyer Dec 12 '12 at 1:00

If you want to save some processing power and it won't mess with the rest of your game, you can also rotate the planet in the opposite direction and leave the camera at one point. :)

share|improve this answer
I was thinking about doing it this way but I figured just moving the camera around the planet would be easiest since I am going to have other objects orbiting the planet at the same time... – Alex_Hyzer_Kenoyer Dec 12 '12 at 13:49
If you have more objects in your scene, it will get harder. I have a camera class in c++ using the winapi for mouse input. I could post it, but it's not really optimised in any way nor is it the right language for you. – Kevin Dec 12 '12 at 13:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.