Vectors rotations 3D camera tiliting

Posted by TallGuy on Stack Overflow See other posts from Stack Overflow or by TallGuy
Published on 2010-01-15T03:22:52Z Indexed on 2010/06/14 1:12 UTC
Read the original article Hit count: 272

Filed under:
|
|
|

Hopefully easy answer, but I cannot get it.

I have a 3D render engine I have written.

I have the camera position, the lookat position and the up vector.

I want to be able to "tilt" the camera left, right, up and down. Like a camera on a fixed tripod that you can grab the handle and tilt it it up, down, left right etc.

The maths stumps me. I have been able to do forwards/backwards dolly and up/down/left/right panning, but cannot work out the vector math to get it to tilt.

For left and right tilt I want to rotate the lookat position around the camera position, but I need to take into account the up vector, otherwise the rotation doesn't know which axis to to turn around.

The maths/algorithm I need is along the lines of...

Camera=(cx,cy,cz) Lookat=(lx,ly,lz) Up=(ux,uy,uz)

RotatePointAroundVector(lx,ly,lz,ux,uy,uz,amount)

Can anyone assist with the maths involved?

Many thanks.

© Stack Overflow or respective owner

Related posts about 3d

Related posts about vector