X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=39ff405faa73a3fe9433fdde86c30c0defc1acac;hp=49661b14a2ce786b87cce1c044ac7d3c299a4f0b;hb=3ffbf1f81f45280aaa92e8c9844868a2d1964ac4;hpb=fe589a3051db988450daaf58dd76b2fb321abdba;ds=sidebyside diff --git a/scene.c b/scene.c index 49661b1..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); @@ -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);