Skip to main content
gamedev.net
🔒 Locked

Simple Rotation Problem :/

Started by MyCatIsTheBest 6 replies 1.2k views
Original Post
MyCatIsTheBest
MyCatIsTheBest
Fixed [Edited by - MyCatIsTheBest on January 29, 2006 4:21:29 PM]
BlueHabu
BlueHabu
Translate to the orgin do your rotation then translate back to the object's orginal position

glTrans
glRot
glTrans
wyled
wyled
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
wyled
wyled
Can you post what dList contains? The problem could be in there.
---John Josef, Technical DirectorGlass Hat Software Inc
BlueHabu
BlueHabu
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
ff8
ff8
or try this
glTranslate*(objx,objy,objz);
glPushMatrix();
glLoadIdentity();
glRotate*();
drawobj();
glPopMatrix();
AAAP
AAAP
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 :)
BlueHabu
BlueHabu
Is there a reason you can't tell us the solution to your problem

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.