Sign in to follow this  

Rotate x and z around 1 point

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

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