Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

2 Answers 2

up vote 6 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

 
discard

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.