Page 1 of 1

camera normal vector ?

Posted: Sun Jun 17, 2007 9:29 am
by chinanzio
I want to throw a ball with normal direccion to the camera . how can i get this vector ?

i've tried with camera->getTarget() but i don't know why the ball doesn't take the direction i want

if some one wants , i paste some code

Posted: Sun Jun 17, 2007 9:56 am
by omar shaaban
:? your english is not very clear but from what i understood u want to throw a ball at the direction of the camera so all u have to do is to
vector3df targertpos=camera->gettarget()
and then take the z and x direction of the ball !

Posted: Sun Jun 17, 2007 10:05 am
by Luben

Code: Select all

vector3df NormalizedCameraZAxis = (Camera->getTarget() - Camera->getPosition()).normalize();

Posted: Sun Jun 17, 2007 10:40 am
by chinanzio
Luben wrote:

Code: Select all

vector3df NormalizedCameraZAxis = (Camera->getTarget() - Camera->getPosition()).normalize();
yes , sorry by my english . thank you Luben , this is the code i needed.