Advertisement

gun position....

Started by August 19, 2001 08:01 AM
4 comments, last by dirtypope 23 years, 6 months ago
arghhhhh im going to rip out my hair soon!!! i know what i need to do, but i cant get it to work, im trying to keep my gun/hand model visible in the lower right of the screen (right handed =P) no matter where i look... i have tried rotating it wil the mouse on x an y axis''s but, the thing is, it doesnt stay in the lower right corner, i need a way to find which way im looking (heading variable) and then put it like -0.2 in that direction rotated properly, im still not sure what im going to do for up/down rotation tho, if this post isnt making sense its because its the wee hours of the morning... please help i have been working on this for, oh i would say 12 hours or somthin.... thanx in advance, dirtypope
Theres no such thing as stupid people... only people with under clocked brains. -dirty
http://www.gamedev.net/community/forums/topic.asp?topic_id=58051




~prevail by daring to fail~
Advertisement
int frame1, frame2; float pol;

glPushMatrix();
gunGetCurrentFrames(&frame1, &frame2, &pol);

glTranslated(Player.Phys.eyex, Player.Phys.eyey, Player.Phys.eyez);//+GameData.GunModels[Player.curGun].Data->minmaxs[4]);
glRotated(Player.Phys.azim*180.0/3.141592, 0.0, 0.0, 1.0);
glRotated(-Player.Phys.elev*180.0/3.141592, 0.0, 1.0, 0.0);
glBindTexture(GL_TEXTURE_2D, GameData.GunModels[Player.GunInfo.curGun].Data->Texture);
md2DrawModel(GameData.GunModels[Player.GunInfo.curGun].Data, frame1, frame2, pol);

glPopMatrix();
and this is how I use _elev_ and _azim_

Player.Phys.dirx = cos(Player.Phys.azim)*cos(Player.Phys.elev);
Player.Phys.diry = sin(Player.Phys.azim)*cos(Player.Phys.elev);
Player.Phys.dirz = sin(Player.Phys.elev);

im not using md2, but im sure the theory of what you posted will work... ill try it
Theres no such thing as stupid people... only people with under clocked brains. -dirty
Hi, I have not read the comments above, but you can download the sourcecode to my 3D-Engine from my homepage... Works fine and is very easy!

SnAkE''s Programming Resources

This topic is closed to new replies.

Advertisement