Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: big sphere, lil camera

  1. #1
    Guest

    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?

  2. #2
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: big sphere, lil camera

    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
    Dolo/\/\ightY
    Dolo/\/\ightY

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •