X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=57803e56aa52f479d83ef5b7066fece38a930337;hp=08daa0170b30a9bde2f0ce0cbbdb1bc322cd6454;hb=cbe1aa264b15c345870500646003c777e4bdef03;hpb=fd6abe24518eccf1b5df971203c378b9170b35ff diff --git a/scene.c b/scene.c index 08daa01..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 * ( (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; + 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