X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=39ff405faa73a3fe9433fdde86c30c0defc1acac;hp=debba608da20efb80cf51e68205f7bdf0538aacd;hb=3ffbf1f81f45280aaa92e8c9844868a2d1964ac4;hpb=9d534bb644d7510782a835c701e4b185957f7e64 diff --git a/scene.c b/scene.c index debba60..39ff405 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; + + sceneObjs[curObject].x += (x - startx) * sin(90 - camAngle*camAngleFactor); + sceneObjs[curObject].z += (x - startx) * cos(90 - camAngle*camAngleFactor); } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) { // w: big/small float diff = (x - startx); @@ -319,7 +322,7 @@ void motion(int x, int y) { sceneObjs[curObject].scale[2] *= scaling; // h: up/down - sceneObjs[curObject].y += (y - starty) * updownFactor; + sceneObjs[curObject].y -= (y - starty) * updownFactor; } starty = y; @@ -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);