X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=25cc0dc1634ce924a84dad5c321dbed67aa1a922;hp=49661b14a2ce786b87cce1c044ac7d3c299a4f0b;hb=aab2e2f70552398a51a24f644147a1c6de45c766;hpb=fe589a3051db988450daaf58dd76b2fb321abdba diff --git a/scene.c b/scene.c index 49661b1..25cc0dc 100644 --- a/scene.c +++ b/scene.c @@ -308,6 +308,9 @@ void motion(int x, int y) { // w: left/right, h: near/far //so.x, so.y, so.z //sceneObjs[curObject].x += (x - startx)*leftrightFactor; + printf("cam angle: %f\n", rotate*rotateFactor); + sceneObjs[curObject].x += (x - startx) * cos(rotate*rotateFactor); + sceneObjs[curObject].z += (x - startx) * sin(rotate*rotateFactor); } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) { // w: big/small float diff = (x - startx); @@ -375,7 +378,7 @@ void display() { 0.0, 10.0, 0.0 /* up is in postivie Y direction */ ); - glRotatef(camAngle*camAngleFactor, 1.0, 0.0, 0.0); + glRotatef(camAngle*camAngleFactor, 1.0, 0.0, 0.0); // Set camera angle upward /* Reposition the light source 0. */ lightPosition0[0] = 12*cos(lightAngle0);