Jump to content
  • Advertisement
Sign in to follow this  
neonoblivion

Rotation Weirdness

This topic is 4905 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
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();

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
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!