Rotation Weirdness

Started by
7 comments, last by neonoblivion 18 years, 11 months ago
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
Advertisement
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();
"I seek knowledge and to help those who also seek it"
That is what I thought <shakes head> :b thx
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...
I had A problem closes to that. It was because I did not conpute normals for my model.
How did not calcing the normals cause that?
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.
--------------------------------If you can't understand what I said, it's not you, it's because my english sucks!
when I do this

sprintf(errorstr,"%f",entities[index].rotation);

and the result printed is

-1.#IND00

what does that meen :(
I figured it, I was using an approx dist function to calc the rotation value and it was tipping over 1 and messing with my acos :b thx

This topic is closed to new replies.

Advertisement