From 3ffbf1f81f45280aaa92e8c9844868a2d1964ac4 Mon Sep 17 00:00:00 2001 From: Ash Tyndall Date: Sat, 22 Oct 2011 10:50:03 +0800 Subject: [PATCH] --- scene.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- 2.20.1