Floating_Inkpot

02-08-2009, 12:05 PM

Hi, i am a bit confused with transforms, angles, vectors & company...

Lets say i have a camera that is pointing towards a direction.

Mycam.Transform returns :

(matrix3 [0.604205,-0.796829,0] [0,0,1] [-0.796829,-0.604205,0] [-61.4619,-46.6042,0])

So if i need the vector of the direction i will type :

Mycam.dir

which returns :

[-0.796829,-0.604205,0]

What i am trying to find, is the Up Vector of the camera. because i want to use the cross product on the Camera Direction to find a Perpendicular vector.

But the Cross product need two vectors forming a plane.

I have the first, which is Mycam.dir and i need a second, wich would be the Camera Up.

Cross MyCam.dir MyCamUp i would find a vector perpendicular to this plane ^^

How to calculate this Camera Up Vector ?

I tryed some vector multiplications, additions etc.... but i think i am a little bit confused with all that mathematics^^ and i need your help i think :p

I searched into the tranform matrix, but there is one thing i dont understand, it is that it contains 4 elements , but it is a matrix3... ?

(matrix3 [0.604205,-0.796829,0] [0,0,1] [-0.796829,-0.604205,0] [-61.4619,-46.6042,0])

What does that stand for ? position, rotation, scale and ?

i tryed also Mycam.transform.rotation

(quat -0.633286 0.314561 0.314561 0.633286)

but a i am not familiar with quaternions, i think i could get the Up vector of the rotation or something like that ?

Thanks for your clarification i hope i will understand it better after that^^

Lets say i have a camera that is pointing towards a direction.

Mycam.Transform returns :

(matrix3 [0.604205,-0.796829,0] [0,0,1] [-0.796829,-0.604205,0] [-61.4619,-46.6042,0])

So if i need the vector of the direction i will type :

Mycam.dir

which returns :

[-0.796829,-0.604205,0]

What i am trying to find, is the Up Vector of the camera. because i want to use the cross product on the Camera Direction to find a Perpendicular vector.

But the Cross product need two vectors forming a plane.

I have the first, which is Mycam.dir and i need a second, wich would be the Camera Up.

Cross MyCam.dir MyCamUp i would find a vector perpendicular to this plane ^^

How to calculate this Camera Up Vector ?

I tryed some vector multiplications, additions etc.... but i think i am a little bit confused with all that mathematics^^ and i need your help i think :p

I searched into the tranform matrix, but there is one thing i dont understand, it is that it contains 4 elements , but it is a matrix3... ?

(matrix3 [0.604205,-0.796829,0] [0,0,1] [-0.796829,-0.604205,0] [-61.4619,-46.6042,0])

What does that stand for ? position, rotation, scale and ?

i tryed also Mycam.transform.rotation

(quat -0.633286 0.314561 0.314561 0.633286)

but a i am not familiar with quaternions, i think i could get the Up vector of the rotation or something like that ?

Thanks for your clarification i hope i will understand it better after that^^