View Full Version : big sphere, lil camera
say you have a big sphere and you put a camera on the sphere. when you move the camera it tranlates around the sphere's surface. but you want the camera to always be upright(for lack of a better word). like us on our planet when we move around we are always 'upright'. so how do you figure out the rotation of the camera from one point to the other as it moves along the surface?
you can do as follows, if you don't mind to get a singularity at the sphere's poles:
-trace a ray from the sphere's center to the camera location.
-normalize, call it Z
-evaluate the cross product between Z and the sphere axis.
-normalize, call it X
-cross product between X and Z, call it Y
now you have an orthonormal basis XYZ, wich its X and Y vectors are tangent to the sphere surface, and Z is the up vector.
hope it helped
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.