Advertisement

easy lesson 48

Started by October 20, 2003 01:09 AM
-1 comments, last by pIpEs ClaNGoR 21 years, 4 months ago
I was skimming through the new lesson and I thought all that was just a little too complicated and I had an easier way to accurately rotate a model. Now I am not saying that this tut is bad and never should be used I just thought it would be a good idea to share some info that I did with everyone.

if (mouse_y2 < mouse_y)	rotatex+=mouse_y-mouse_y2;
if (mouse_y2 > mouse_y)	rotatex-=mouse_y2-mouse_y;
if (mouse_x2 < mouse_x)	rotatey+=mouse_x-mouse_x2;
if (mouse_x2 > mouse_x)	rotatey-=mouse_x2-mouse_x;

glRotatef(rotatex,1.0f,0.0f,0.0f);
glRotatef(rotatey,0.0f,1.0f,0.0f);
see what I did here is get a copy of the prev. mouse cord. and the current mouse cord. and subtracted them then added or subtract with the current rotation according if the mouse was moved up, down, left, or right and then rotated the model with that number. Just thought it be easyer that way. edit: I didn't notice this till just now but the only advatage to lesson 48 from this is that it rotated the z axis too. This way doesn't. --------------------------- The pipes clangor all the time. [edited by - pipes clangor on October 20, 2003 2:12:37 AM]
---------------------------The pipes clangor all the time.

This topic is closed to new replies.

Advertisement