X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=0757dc69e99fe28316e9da45a8ac1b5f7b5a3f9e;hp=99ccfa0b902ca7fdbc6102addaf2b1708302d733;hb=4c0429485833a26036f9d527ec9d81bf727b5a53;hpb=97f14d98d0a9bee56fdaebcea092dba1925c9552 diff --git a/scene.c b/scene.c index 99ccfa0..0757dc6 100644 --- a/scene.c +++ b/scene.c @@ -307,10 +307,14 @@ void motion(int x, int y) { // w: left/right, h: near/far // **NOTE: Currently a work in progress, does not work correctly + float angler = 2 * M_PI * ( (rotate*camRotateFactor)/360.0 ); printf("cam angle: %f\n", rotate*camRotateFactor); - // float arc = arctan() - sceneObjs[curObject].x += diffx * sin(rotate*camRotateFactor); - sceneObjs[curObject].z += diffx * cos(rotate*camRotateFactor); + + sceneObjs[curObject].x += diffx * cos(angler) * 0.1 + diffy * cos(M_PI/2 + angler) * 0.1; + sceneObjs[curObject].z += diffx * sin(angler) * 0.1 + diffy * sin(M_PI/2 + angler) * 0.1; + + //sceneObjs[curObject].x += ; + //sceneObjs[curObject].z += ; } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) { // w: big/small