PDA

View Full Version : quake movement problems



Bruno
05-17-2000, 05:49 AM
HelloI have a problem
I' tryng to implement a movement similar to quake, half-life and family,
but i need help.
In this case, when the player press forward or back, i make a translation
of 10 or -10 while the key is pressed, and it's all fine.
When i press the left or right key to rotate, the camera also rotates
in the direction that i wan't, but she rotates as if the camera was
still in the origin(0,0,0).

typedef struct{
float x;
float y;
float z;
float xrot;
float yrot;
float zrot;
}camera;

camera look;

when i press forward, i add the look.x 10 units
when i press back i subtract look.x 10 units
when i press left, i add the angle +10;
when i press right i subtract the angle -10;

glLoadIdentity();
glTranslatef(look.x,look.y,look.z);
glRotatef(angle,0,look.yrot,0);


If i make the translation first and then the rotation, the rotation
works fine, but only if i still hadn't pressed the forward button
If i press the forward button first, and then the left or right, the
rotation is not correct, he rotates as if the rotation was being made
at the origin.

Please advice

Thanks
Bruno

Bruno
05-17-2000, 09:24 AM
I fix it
thanks anyway