gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Camera problem

#61411 - Webez - Sat Nov 19, 2005 9:26 pm

Hi.

I have made a class for moving the camera using position,up and view vectors but it does not work very well. It seems as if instead of moving the camera it moves the world. I have uploaded the camera code and a demo to show the problem. If someone wants to look at it and see what happens to it I would be very grateful. Feel free to use it if you find the class useful!!

Thanks!!!

http://www.4shared.com/file/491273/a8fe91bd/Camera.html
http://www.4shared.com/file/491269/513049e2/ndsds.html

Camera usage:

DS_Camera *camera=new Camera(px,py,pz,vx,vy,vz,ux,uy,uz);

In the loop
camera->update(); "looks if it has to translate and calls gluLookAtf32"

call DS_Input::readTouch() (if you want to use touchView) and DS_Input::readKey() to read touch and key

to move the camera
if (DS_Input::keyHeld(KEY_UP)){
camera->action=forward;
}
if (DS_Input::keyHeld(KEY_A)){
camera->action=rotateL;

}

...[/url]