PDA

View Full Version : Transforming a vector



What3v3r
08-29-2002, 11:52 AM
Hi, i have it almost working, i guess i'm missing a little thing about transformations or something.... i'm poor at math and that could probably be the reason. Well, read this (just to be SURE that's right).

- Transforming light vector (world space) into object space -

lightPos(0.0, 1.0, 1.0);
zeroVector(0.0, 0.0, 0.0);

I translate my world by -lightPos so the light stays on (0.0, 0.0, 0.0), maybe the name lightPos isn't the name i should use, but you get it. So i'm transforming lightPos(0.0, 1.0, 1.0) which is in world space to object space in this way:

newLightPos = zeroVector - (-lightPos);
// OR
newLightPos = zeroVector + lightPos;

Is this vector well transformed ? If don't, kick me http://www.opengl.org/discussion_boards/ubb/smile.gif

Thanks, bye http://www.opengl.org/discussion_boards/ubb/smile.gif