(no commit message)
[atyndall/cits2231.git] / scene.c
diff --git a/scene.c b/scene.c
index 281f99f..57803e5 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -305,12 +305,9 @@ void motion(int x, int y) {
 \r
       if ( buttonSelected == GLUT_LEFT_BUTTON ) {\r
         // w: left/right, h: near/far\r
-\r
-        // **NOTE: Currently a work in progress, does not work correctly\r
-        printf("cam angle: %f\n", rotate*camRotateFactor);\r
-       // float arc = arctan()\r
-        sceneObjs[curObject].x += diffx * sin(rotate*camRotateFactor);\r
-        sceneObjs[curObject].z += diffx * cos(rotate*camRotateFactor);\r
+        float angler = 2 * M_PI * ( (rotate*camRotateFactor)/360.0 );\r
+        sceneObjs[curObject].x += diffx * cos(angler) * leftrightFactor + diffy * cos(M_PI/2 + angler) * nearfarFactor;\r
+        sceneObjs[curObject].z += diffx * sin(angler) * leftrightFactor + diffy * sin(M_PI/2 + angler) * nearfarFactor;\r
 \r
       } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
         // w: big/small\r
@@ -413,7 +410,7 @@ void display() {
   glPushMatrix();\r
 \r
     /* Perform scene rotations based on user mouse/keyboard input. */\r
-    //glRotatef(rotate*camRotateFactor, 0.0, 1.0, 0.0);\r
+    glRotatef(rotate*camRotateFactor, 0.0, 1.0, 0.0);\r
     glTranslatef(camx, camy, camz);\r
     glRotatef(keyrot, 1.0, 0.0, 0.0);\r
 \r

UCC git Repository :: git.ucc.asn.au