PDA

View Full Version : Opening door...



gamerixe
07-03-2003, 03:47 PM
Im trying to rotate an object ""a door in my case",around his rotation point,in fact im trying to do a door.The probleme is that im trying to move the center of rotation to the door's axe and I doesn't seem to get the trick with matrix "operation".

Thank for any trick you could share. http://www.opengl.org/discussion_boards/ubb/smile.gif

Sourpotato
07-03-2003, 07:12 PM
Between glrotate and your drawDoor() code, you can draw the x,y,z axis .so when application runs , you can get better picture on where the door are placed in the current transformed coordinate system.

gvm
07-03-2003, 10:11 PM
maybe you should swap glTranslate and glRotate in your code!
here is how it must be:
glPushMatrix();
glTranslatef(position_of_the_door_in_space)
glRotatef(rot_angle,0,1,0);
glTranslatef(offset_-_this_will_move_axis);
DrawDoor();
glPopMatrix();

here is the values for example if yourdoor at (0,0,0) and its size by x is 2;
offset.x = 1;
position = vec3(0,0,0);

[This message has been edited by gvm (edited 07-04-2003).]

gamerixe
07-04-2003, 03:41 AM
Thank! http://www.opengl.org/discussion_boards/ubb/smile.gif