Rotate view matrix based on touch coordinates

Posted by user1055947 on Game Development See other posts from Game Development or by user1055947
Published on 2013-07-20T14:54:12Z Indexed on 2013/08/02 16:08 UTC
Read the original article Hit count: 393

Filed under:
|
|
|
|

I'm working on an Android game where I need to rotate the camera around the origin based on the user dragging their finger. My view matrix has initial position of sitting on the negative z and facing origin. I have succeeded in moving the camera through rotation left or right, up or down based on the user dragging the finger, but my problem is obviously that after I drag my finger up/down and rotate say 90 degrees so my intial position of -z is now +y and still facing origin, if I drag my finger left/right I want to rotate from +y to +x, but what happens is it rotates around the pole +y. This is to be expected as I am mapping 2D touch drag coords to 3D space, but I dont know where to start trying to do what I want. Perhaps someone can point me in the right direction, I've been googling for a while now but I don't know what I want to do is called!

Edit __ What I was looking for is called an ArcBall, google it for lots of info on it.

© Game Development or respective owner

Related posts about opengl

Related posts about 3d