Aviran
Aviran

Reputation: 5458

Find camera right and up vectors

I have this camera setup:

Pos(px,py,pz)
LookAt(lx,ly,lz)
Up(ux,uy,uz)

I need to find the cameras right and up vectors, a way to find them with an explanation would be greatly appreciated. thanks.

Upvotes: 1

Views: 1986

Answers (1)

Ani
Ani

Reputation: 10896

It seems you already have a camera pos (p), target (l) and up (u) vectors. To calculate right, find the cross product of (p - l) and (u - p).

This will give you a vector orthogonal to both, the "right" vector.

Upvotes: 3

Related Questions