(no commit message)
authorAsh Tyndall <[email protected]>
Sat, 22 Oct 2011 05:14:52 +0000 (13:14 +0800)
committerAsh Tyndall <[email protected]>
Sat, 22 Oct 2011 05:14:52 +0000 (13:14 +0800)
globals.h
scene.c

index 5dd4300..fe6d362 100644 (file)
--- a/globals.h
+++ b/globals.h
 #define NTEXTURE 30     // The number of textures (in the models-textures dir)
 #define MAXOBJECTS 256
 
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
 // Meshes and textures arrays
 extern mesh* meshes[];
 extern texture* textures[];
diff --git a/scene.c b/scene.c
index 0834fa2..5dd48fd 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -307,10 +307,11 @@ void motion(int x, int y) {
         // w: left/right, h: near/far\r
 \r
         // **NOTE: Currently a work in progress, does not work correctly\r
+        float angler = 2*M_PI*((rotate*camRotateFactor)/360);\r
         printf("cam angle: %f\n", rotate*camRotateFactor);\r
        // float arc = arctan()\r
-        sceneObjs[curObject].x += diffx * sin(rotate*camRotateFactor) * 0.3;\r
-        sceneObjs[curObject].z += diffx * cos(rotate*camRotateFactor) * 0.3;\r
+        sceneObjs[curObject].x += diffx * sin(angler) * 0.3;\r
+        sceneObjs[curObject].z += diffx * cos(angler) * 0.3;\r
 \r
       } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
         // w: big/small\r

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