// move to player
GLfloat x, z;
x = xpos - (float)sin ( heading * piover180 ) * 0.05f;
z = zpos - (float)cos ( heading * piover180 ) * 0.05f;
glTranslatef ( x + 0.15f, 0.15f, z - 0.5f );
// also rotate
glRotatef ( yrot, 0.0f, 1.0f, 0.0f );
glRotatef ( -lookupdown, 1.0f, 0.0f, 0.0f );
Placing Weapon In Ego Perspective
Hello everybody,
I am working on a simple ego-shooter at the moment. Everything is fine except, that the weapon model needs to turn correctly around the player, in order to stay placed correctly whenever the player turns.
At the moment it just turns around itself and not the player. I know NeHe mentions this point somewhere in his tutorials but I couldn't find anything there.
This is my relevant code: ( I based my code upon NeHe's Tutorial 10 )
The translating part works fine now, but still the weapon rotates around its own centre point and not the players.
Is there an (easy) way to fix this (I just started with OpenGL two days ago ;) )...
Thanks.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement