ofEasyCam with gui


Using ofEasyCam find dificult to get precise movements because when the mouse i want to rotate only one axis and is very hard to do, so i thinked using gui parameters to interact with the camera.

I tried using setPosition, setOrientation but with those it do not work the same as with the mouse, i mean to translate and rotate.

What methods i need to implement with gui to mimic mouse interaction?.

I tried this way but not the result i expected… i hope im explaining myself right

    ofQuaternion rotX, rotY, rotZ;
    rotX.makeRotate(orientationX, ofVec3f(1,0,0));
    rotY.makeRotate(orientationY, ofVec3f(0,1,0));
    rotZ.makeRotate(orientationZ, ofVec3f(0,0,1));
    cam.setPosition(posX, posY, posZ);
    //cam.lookAt(ofVec3f(0, 0, 0));
    cam.setOrientation(rotX * rotY * rotZ);

Ok, i think i got it, i looked inside ofEasyCam code and tried to mimic.

pos and orientation are gui parameters.

Now i can move the camera and rotate with a gui

    cam.setGlobalPosition(cam.getGlobalPosition()+ofVec3f(posX, posY, posZ));
    ofQuaternion rot(orientationX, cam.getXAxis(), orientationY, cam.getYAxis(), orientationZ, cam.getZAxis());
    ofNode target = cam.getTarget();
    cam.setPosition((cam.getGlobalPosition()-target.getGlobalPosition())*rot + target.getGlobalPosition());