From: Ash Tyndall Date: Sat, 22 Oct 2011 02:50:03 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=commitdiff_plain;h=3ffbf1f81f45280aaa92e8c9844868a2d1964ac4;ds=sidebyside --- diff --git a/scene.c b/scene.c index 4852c0b..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);