X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=57803e56aa52f479d83ef5b7066fece38a930337;hp=ee4f6148b0e21499b4a9c9fdef7032e563537972;hb=cbe1aa264b15c345870500646003c777e4bdef03;hpb=abac37ff45eff5c4c818dc72a01020818bfdece2 diff --git a/scene.c b/scene.c index ee4f614..57803e5 100644 --- a/scene.c +++ b/scene.c @@ -305,13 +305,9 @@ void motion(int x, int y) { if ( buttonSelected == GLUT_LEFT_BUTTON ) { // w: left/right, h: near/far - - // **NOTE: Currently a work in progress, does not work correctly - float angler = 2 * M_PI * ( (90 - rotate*camRotateFactor)/360.0 ); - printf("cam angle: %f\n", rotate*camRotateFactor); - // float arc = arctan() - sceneObjs[curObject].x += diffx * cos(angler) * 0.3; - sceneObjs[curObject].z += diffx * sin(angler) * 0.3; + float angler = 2 * M_PI * ( (rotate*camRotateFactor)/360.0 ); + sceneObjs[curObject].x += diffx * cos(angler) * leftrightFactor + diffy * cos(M_PI/2 + angler) * nearfarFactor; + sceneObjs[curObject].z += diffx * sin(angler) * leftrightFactor + diffy * sin(M_PI/2 + angler) * nearfarFactor; } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) { // w: big/small