Sign in to follow this  

Rotation Weirdness

This topic is 4596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

These lines blink on and off apparently dependant upon the rotation
glPushMatrix();
   glTranslatef(entities[index].x,getheight(entities[index].x,entities[index].z),entities[index].z);
   glRotatef(entities[index].rotation,0,1,0);
   glBegin(GL_LINES);
      glColor3f(0,1,0);
      glVertex3f(0,5,0);
      glVertex3f(0,-5,0);
      glVertex3f(0,2,1);
      glVertex3f(0,2,-1);
   glEnd();
glPopMatrix();

Is there any thing I could be doing (in this code) to cause the lines to disapear? Weather or not it has anything to do with rotation :b

Share this post


Link to post
Share on other sites
Within the code you posted, the only possible way to lose your lines, is if you moved them off with translate, or you rotated them off with glrotate,

if (Both == false)
Problem_Is_Else_where();

Share this post


Link to post
Share on other sites
How would it be possible to rotate it off screen? The way I have it set currently it seems to disapear when the rotation value hits 90 or 270, but if set the rotation manually to 90/270 it doesn't disapear. I question the rotation being at fault because it should (and does allmost all the time) rotate around the center of its mass...

Share this post


Link to post
Share on other sites
The rotation has no effect on the first line (0, -5, 0) -> (0, 5, 0), because it is parallel to the Y axis (the axis of rotation).
The second line (0, 2, 1) -> (0, 2, -1) it does rotate, and its midpoint spans a circle of radius 2 parallel to the XZ plane when the Y rotation is applied.

Try removing the translation to verify if this is what really happens. The error may be in some other places in your code, in the last places you may expect it to be :o.

Share this post


Link to post
Share on other sites

This topic is 4596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this