free moving

Started by
1 comment, last by IStrikerI 22 years, 9 months ago
i have a problem with free moving in my 3d-world: i can move to the directions forward, backward, strafing left and right and i can look to any direction with my mouse. and now i want it, that i can move to any direction i am looking like the spectator mode in the quake engines. here is a part my code. can anyone help me to change the code that i can move to any direction i am looking? or has anybody a better way of moving in a 3d-world - please tell me !! ... i think i have to say that the core of this code is from the nehe tutorials void Update() { static float xrot=0,yrot=0; static float xpos=0,ypos=0,zpos=0; if(win.key[VK_UP]) { xpos-=(float)sin(-yrot*pi180)*0.05f; zpos-=(float)cos(-yrot*pi180)*0.05f; } if(win.key[VK_DOWN]) { xpos+=(float)sin(-yrot*pi180)*0.05f; zpos+=(float)cos(-yrot*pi180)*0.05f; } if(win.key[VK_LEFT]) { xpos-=(float)cos(yrot*pi180)*0.05f; zpos-=(float)sin(yrot*pi180)*0.05f; } if(win.key[VK_RIGHT]) { xpos+=(float)cos(yrot*pi180)*0.05f; zpos+=(float)sin(yrot*pi180)*0.05f; } mouse.GetState(); yrot+=(float)mouse.mstate.lX; xrot+=(float)mouse.mstate.lY; glRotatef(xrot,1.0f,0.0f,0.0f); glRotatef(yrot,0.0f,1.0f,0.0f); glTranslatef(-xpos,-ypos,-zpos); }
Advertisement
shit !!
now i got it!!
i think it was too easy
what''d you do?



Email
Website

"If you try and don''t succeed, destroy all evidence that you tried."

This topic is closed to new replies.

Advertisement