Simple Rotation Problem :/

Started by
6 comments, last by BlueHabu 18 years, 2 months ago
Fixed [Edited by - MyCatIsTheBest on January 29, 2006 4:21:29 PM]
Advertisement
Translate to the orgin do your rotation then translate back to the object's orginal position

glTrans
glRot
glTrans
More specifically you need to translate to the center of the object.

glTranslate(obj.width/2, obj.height/2, obj.depth/2)
glRotatef(roty, 0, 1, 0);
glColor3f(0, 0, 1);
glCallList(dList);
glPopMatrix();
---John Josef, Technical DirectorGlass Hat Software Inc
Can you post what dList contains? The problem could be in there.
---John Josef, Technical DirectorGlass Hat Software Inc
From your code
Quad[4][3][2] = 0 + loc[2] + width;

Completely off topic but why is there a 0 here. I am just curious if there is a reason for this I am not aware of.

not 100% but try this

trans(-loc[0], -loc[1], -loc[2])
rot
trans(loc[0], loc[1], loc[2])

or LoadIndentiy after push matrix
or try this
glTranslate*(objx,objy,objz);
glPushMatrix();
glLoadIdentity();
glRotate*();
drawobj();
glPopMatrix();
theres 2 things that i know of that cause this.

1. the objects in your matrix arent centered.

or

2. you perform a rotation before translation.


the former would look more "orbity" though.
|aaap.penopticon.com| My website, including game projects. Collaboration/comments are welcome, please visit :)
Is there a reason you can't tell us the solution to your problem

This topic is closed to new replies.

Advertisement