Jump to content
  • Advertisement
Sign in to follow this  
Renran

Rotate x and z around 1 point

This topic is 3193 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

Hello, It eludes me. I want the arrow keys left and right rotate around 1 point(x,z). I can't find it after a lot of searching. What's wrong with the code (otherwise working fine) ------------------------------------------------------------------------------ typedef struct Vector { double x,y,z; }Vector; Vector V1; Vector V2; Vector orientation; /* Point 3D */ typedef struct Point { double x,y,z; }Point; Point eye; Point point; void Vecteur_pVect(SVecteur *V1, SVecteur *V2, SVecteur *V3) { V3->x=V1->y*V2->z-V1->z*V2->y; V3->y=V1->z*V2->x-V1->x*V2->z; V3->z=V1->x*V2->y-V1->y*V2->x; } --------------------------------------------------------------------- eye.x = 0.0f; eye.y = 0.0f; eye.z = 130.0f; point.x = 0.0f; point.y = 0.0f; point.z = 0.0f; V1.x = 1.0f; V1.y = 0.0f; V1.z = 0.0f; V2.x = point.x-eye.x; V2.y = point.y-eye.y; V2.z = point.z-eye.z; Vecteur_pVect(&V1,&V2,&orientation); gluLookAt(eye.x,eye.y,eye.z, point.x,point.y,point.z, orientation.x,orientation.y,orientation.z); glTranslated(param.transrl,param.transyy,param.transud); glRotated(hoek,1.0,0.0,0.0); glRotated(charleft,0.0,1.0,0.0); //arrowkeys = charleft = left and right around 1 point == not working glTranslated(0.0, 0.0, 0.0); ------------------------------------------------------------------------------ Thanks a lot, Renran

Share this post


Link to post
Share on other sites
Advertisement
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!