[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] First person shooter help



I recommend just improvising. 

My take is, you will probably want some sort of general camera direction (in the horizontal plane) and a pointer direction where you're aiming (can rotate on the screen within the view). 

You should be using gluLookAt(camx,camy,camz,centerx,centery,centerz,upx,up,y,upz).  [camx,camy,camz] is simply the player's position in 3D space.  [centerx,centery,centerz] is [camx,camy,camz] + ([1,0,0], rotated by the player's direction around [0,1,0]).  [upx,upy,upz] is [0,1,0].  To find where the cursor is pointing, project the mouse into the 3D scene.  This gives you a view controlled by the player's direction, and a movable aiming point inside.

If you want where you're aiming to be the center of the screen, rotate the view by the relative mouse movement. 

Ian